cannot run API in python
Hi,
I can run RIC in both eikon desktop and Eikon add-in. But cannot run it in python.
It kept running without any outputs.
see screenshot
regards,
ray
Best Answer
-
Hi @rayr.hou
Thanks for getting back with the above details.
Based on the error message, this is the same scenario as reported and diagnosed prevoiusly in Trying to execute code from CODEBOOK to a python file, ERROR "Your request is prohibited because the request is on loopback from external IP." - Forum | Refinitiv Developer Community
As explained by my colleague @Alex Putkov. in the above post,
What's happening is that, even though the HTTP request is directed to the localhost, your HTTP proxy intercepts it. After intercepting the request the proxy returns the request to your machine, but now to Eikon API Proxy the request appears as coming from a remote machine (as it comes from the IP address of the HTTP proxy). Eikon API Proxy rejects the request with the error message that you've seen because it only allows the requests coming from the same machine.
Therefore, you will need to speak to your internal network team/security team to configure your proxy settings to allow HTTP requests directed to the localhost to not be intercepted by your HTTP proxy.
If they need assistance with doing this, I recommend they contact the Refinitiv Eikon Helpdesk - which can be done directly from within Eikon OR via My.Refinitiv
0
Answers
-
Hi @rayr.hou ,
I can run it properly on both Python in the Command Prompt and using Jupyter Notebook, would you mind retry running the code again? and then maybe try to print the df again after your current code is executed.
Please tell me in case the issue still persist, I'll try to do the further investigation.
0 -
I reran the code and df seems not executed so that i cannot print df. I am using pycharm.
0 -
hi @rayr.hou ,
can you try put print(df) instead of just df, to print the value out on PyCharm console
hope this could help.
0 -
I tried to run df first, but it seems not executed. i had been letting it for the whole morning.....
I found some problems showing in pycharm, but not sure if it can explain why df is not being executed...
0 -
Hi @rayr.hou
Please rename your eikon.py file to something else e.g. eikontest.py
This will allow the import eikon command to import the eikon library correctly.
1 -
I tried and no problems were showing. But df was still not executing.0
-
Hi @rayr.hou
Please try the following:
import eikon as ek
import logging
ek.set_app_key('your app key')
ek.set_log_level(logging.DEBUG)
ek.__version__
df=ek.get_timeseries('MSFT.O',start_date='2016-01-01',end_date= '2016-01-10',raw_output=True)
print(df)And then paste the output here - excluding the x-tr-applicationid value and 'Authorization': 'Bearer ....' data - do not include those as they are confidential.
0 -
hi @rayr.hou ,
your original comment has been removed as it contains the app key, here's what you posted without the confidential data.
0 -
Hi @rayr.hou
If you see no further output beyond what you have posted above, it would indicate you are not getting any response from the Eikon API Proxy
Please try the following in a browser and see what response you get for each:
If you can clear the Cache on Eikon and restart Eikon to see if that helps - you can find the Clear Cache option in your Window Start menu under Thomson Reuters / Refinitiv -> Eikon Tools.
0 -
Hi @rayr.hou
I would also recommend you upgrade to the later Eikon library
pip install eikon==1.1.12
and also change the earlier code snippet order
import eikon as ek
ek.set_log_level(1)
ek.set_app_key('your app key')
ek.__version__
df=ek.get_timeseries('MSFT.O',start_date='2016-01-01',end_date= '2016-01-10')
print(df)0 -
both shows
{"statusCode":"ST_PROXY_READY","version":"2.9.0"}
0 -
After clear the Cache and upgrade to the later library, it shows below when i ran the code you provided
import eikon as ek
ek.set_log_level(1)
ek.set_app_key('appkey')
2021-09-15 21:11:01,863 P[15836] [MainThread 17872] Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...
2021-09-15 21:11:01,864 P[15836] [MainThread 17872] Request to http://127.0.0.1:9060/api/status
headers = {'x-tr-applicationid': 'appkey'}
params = None
2021-09-15 21:11:01,925 P[15836] [MainThread 17872] HTTP request response 400: <HEAD><TITLE>Request on loopback from external IP</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Request on loopback from external IP</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Your request is prohibited because the request is on loopback from external IP.</B></FONT>
<HR>
<!-- default "Request on loopback from external IP" response (400) -->
</BODY>
0 -
2021-09-15 21:11:01,926 P[15836] [MainThread 17872] Port 9060 was retrieved from .portInUse file
2021-09-15 21:11:01,926 P[15836] [MainThread 17872] Try to handshake on url http://127.0.0.1:9060/api/handshake...
2021-09-15 21:11:01,927 P[15836] [MainThread 17872] Request to http://127.0.0.1:9060/api/handshake
headers = {'Content-Type': 'application/json', 'x-tr-applicationid': 'appkey'}
params = None
2021-09-15 21:11:01,967 P[15836] [MainThread 17872] HTTP request response 400: <HEAD><TITLE>Request on loopback from external IP</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Request on loopback from external IP</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Your request is prohibited because the request is on loopback from external IP.</B></FONT>
<HR>
<!-- default "Request on loopback from external IP" response (400) -->
</BODY>
0 -
2021-09-15 21:11:01,967 P[15836] [MainThread 17872] Response : 400 - <HEAD><TITLE>Request on loopback from external IP</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Request on loopback from external IP</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Your request is prohibited because the request is on loopback from external IP.</B></FONT>
<HR>
<!-- default "Request on loopback from external IP" response (400) -->
</BODY>
0 -
2021-09-15 21:11:01,967 P[15836] [MainThread 17872] Response 400 on handshake port 9060 : <HEAD><TITLE>Request on loopback from external IP</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Request on loopback from external IP</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Your request is prohibited because the request is on loopback from external IP.</B></FONT>
<HR>
<!-- default "Request on loopback from external IP" response (400) -->
</BODY>
2021-09-15 21:11:01,967 P[15836] [MainThread 17872] Application ID: appkey
2021-09-15 21:11:01,968 P[15836] [MainThread 17872] Init a Desktop session with new app_key
2021-09-15 21:11:01,968 P[15836] [MainThread 17872] Port 9060 on local proxy was detected
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 中文论坛