Python API - Error code 407
Hi,
I'm trying to set the Eikon Python API on my computer in order to retrieve data directly in Python instead of using the Excel add-in.
I installed the necessary Python package and I use the following code to test (I found it in the codebook examples).
import refinitiv.dataplatform.eikon as ek
ek.set_app_key('my-app-key')
df,err = ek.get_data(['PEUP.PA', 'EUR=', 'JPY='], ['BID','ASK'])
df
Unfortunately, I get the following error:
Error code 407 | Client Error: Proxy Authentication Required - <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Could you please help me solve the issue ? it seems it comes from the proxy. Is there a config file I should update to provide the proxy address and my credentials ?
I try to run the Python API on the same computer where Eikon is installed. I get this issue independently of the app_key I input (if it's the correct one or a dummy one).
Thank you in advance.
Thomas
Best Answer
-
The HTTP response 407 is Proxy Authentication Required. The Eikon Data API connects to the Eikon via the localhost (127.0.0.1). I assume that the following error was sent by your internal proxy server.
2022-04-20 12:59:26,432 P[14800] [MainThread 8624] HTTP request response 407: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
...
<div class="longExplanation">
Your credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your credentials can be verified.
</div>You should contact your local IT support team to verify internal proxy settings, as mentioned by my colleague.
You can also run the following code to verify the connection.
import requests
r = requests.get('http://127.0.0.1:9060/api/status')
print(r.status_code)
print(r.content)The output is:
0
Answers
-
Please follow the steps in the Eikon Data API(Python) Troubleshooting to verify the problem.
And, you can enable logging in to Eikon Data API by using the following command.
ek.set_log_level(1)
You can share the log file when the problem occurred.
Note that the Eikon Desktop/Refinitiv Workspace also has to be running on the same machine as mentioned in the troubleshooting guide.
2 -
Also, the error indicates that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource. IT Team needs to look at your Proxy Server or SSO/Kerberos Server to make sure that it is sending out the request packet to our server with your credentials attached to it. So please, contact the local IT support team to verify the problem once as well.
Thanks,
1 -
I followed the instructions on the troubleshooting page, everything seem to work except the check of the logs (I cannot change the configuration of the eikon log however, so I could not check the step: Locate "APIPROXY" and "API Proxy is available on port XXXX" in the log file. By default, the port is 9060).
I run the following code:
import eikon as ek
ek.set_log_level(1) #This is to enable log detail
ek.set_app_key(app_key='xxxxxxxxxxxxxxxx') #A valid app key is required.I get the following error (extract):
2022-04-20 12:59:26,357 P[14800] [MainThread 8624] Reset a Desktop session with new app_key
2022-04-20 12:59:26,373 P[14800] [MainThread 8624] Unlock login_event for streaming session 0 due to stop streaming call
2022-04-20 12:59:26,392 P[14800] [MainThread 8624] Send GET request to http://x.x.x.x:9060/api/status to detect API Proxy...
2022-04-20 12:59:26,407 P[14800] [MainThread 8624] Request to http://x.x.x.x:9060/api/status
headers = {'x-tr-applicationid': 'xxxxxxxxxxxxxxxx'}
params = None
2022-04-20 12:59:26,432 P[14800] [MainThread 8624] HTTP request response 407: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
...
<div class="longExplanation">
Your credentials could not be authenticated: "Credentials are missing.". You will not be permitted access until your credentials can be verified.
</div>
...0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛