Trying to execute code from CODEBOOK to a python file, ERROR "Your request is prohibited because ...

...the request is on loopback from external IP."
Hello, I am playing with the codebook, I am trying to use the same code to a .py file, whenever I execute the file, it gives me an error saying: "
Your request is prohibited because the request is on loopback from external IP.
Here an example of what I am doing.
import refinitiv.dataplatform.eikon as ek
from datetime import datetime, timedelta
ek.set_app_key('My_Key')
#Reinvestment Rate
RRuson=ek.get_timeseries(['USONFFE='],start_date="2020-10-23",end_date="2020-10-23")['CLOSE'].values[0]
ERROR:
<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>
Thanks
Best Answer
-
Thank you for the logs. Now I think I have a reasonably good idea about your case. The fact that you reproduce the same error using Internet browser clearly indicates that the problem is not within your Python environment. It must be due to your proxy settings. 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.
You need to configure your proxy settings to allow HTTP requests directed to the localhost to not be intercepted by your HTTP proxy.0
Answers
-
How do you execute your .py file? As as quick test I just created a file named APTest.py in the root of my Codebook directory with the code I copied from your post. Then I opened a Jupyter notebook from the root of my Codebook directory and executed the following code in a Jupyter notebook cell
import APTest as t
print(t.RRuson)The value of the Fed Funds effective rate was printed as expected.
0 -
Hi, i am just executing the code on vs code and spyder, I am trying to do an automated process to save certain values around 5 PM
0 -
Is Eikon desktop application running on the machine where you execute your Python code? Eikon Data APIs have runtime dependency on Eikon desktop application. Note that it has to be Eikon desktop application, not Eikon Web that you can access through a browser.
0 -
Yes, Eikon desktop application is running
0 -
OK, now that we've covered the basics, could you tell me how you experience the error? Do you see any exceptions raised? If yes, which line of code raises the exception and can you include the traceback? Where does the HTML with the error message in your original post come from? I'm struggling to understand how any error could have manifested as HTML in your scenario. Perhaps you could include a screenshot of the result of your code execution in VS Code? And also try increasing the logging level in RDP Library. Add ek.set_log_level(5) after ek.set_app_key.
Finally, instead of using RDP Library, try using Eikon Data APIs library. Both libraries should work, but Eikon Data APIs library may be better for troubleshooting until we figure out what's wrong. To use Eikon Data APIs library follow the Quick Start Guide on this portal.
0 -
I am just running the code, when i try to get the data a log raise with the error in html, thats alli know, the error raises when i try to run:
RRuson=ek.get_timeseries(['USONFFE='],start_date="2020-10-23",end_date="2020-10-23")['CLOSE'].values[0]
and the html with the error creates by itself
0 -
Could you please respond to all the rest of the comments in my previous post: increase the log level; get a screenshot of the code execution in VS Code with the error message; try Eikon Data APIs library.
0 -
this is what i get from the new log file created on the same path of my py file
[2020-10-27 16:49:18,371;s] - [TRACE] - [<lambda>] - entity: TimeSeries
[2020-10-27 16:49:18,371;s] - [TRACE] - [<lambda>] - payload: {'rics': ['USONFFE='], 'fields': ['*'], 'interval': 'daily', 'startdate': '2020-10-26T00:00:00', 'enddate': '2020-10-26T00:00:00'}
[2020-10-27 16:49:18,371;s] - [DEBUG] - [send_json_request] - Request:{'Entity': {'E': 'TimeSeries', 'W': {'rics': ['USONFFE='], 'fields': ['*'], 'interval': 'daily', 'startdate': '2020-10-26T00:00:00', 'enddate': '2020-10-26T00:00:00'}}}
[2020-10-27 16:49:18,371;s] - [DEBUG] - [log] - Request to http://127.0.0.1:9060/api/v1/data
headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '*********my_key*********'}
params = None
[2020-10-27 16:49:18,385;s] - [DEBUG] - [send_json_request] - HTTP Response code: 4000 -
The only thing that I want to do is get the data and put it into a database, the problem is that I need to run this code on a separate file, not in the codebook, because this has to be an automatized process around 5 pm, is there a way to execute this code every day without me running it?
0 -
It is perfectly possible as long as your code is executed on the machine where Eikon desktop application is installed, and as long as Eikon desktop application is running at the time your code is executed. Could you post the full log file you created? Zip it and attach it to your next post on this thread. I'm still missing two other things I asked for previously: screenshot of the code execution in VS Code with the error message and the result of using Eikon Data APIs library instead of RDP Library. Could you also try executing the following request: ek.get_data('EUR=','BID')?
0 -
Here are the files
0 -
Thank you very much for the screenshots, they are most useful. I'm afraid this is a very puzzling issue. Nothing like I've seen before. To dig a bit deeper, could you try entering the following in the address bar of the Internet browser on the machine where you run your Python code and share the response: http://127.0.0.1:9060/api/status
I will also need a couple of log files from Eikon desktop application. Please see Chapter 3 "Verify that Eikon Desktop is running properly and APIPROXY service is enabled" in this article. It contains instructions for enabling logging in Eikon application. The specific log files I'm interested in are APIProxy.YYYYMMDD.HHMMSS000.pXXXX.txt and SxS.YYYYMMDD.HHMMSS000.pXXXX.txt. You will need to shut down Eikon, configure logging using Configuration Manager application, then start Eikon, run your Python script and then collect the above log files.
0 -
Hello, i run http://127.0.0.1:9060/api/status on my machine and says:
Request on loopback from external IP
here are the log files requested.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 642 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 89 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛