For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 4

R eikonapir - Proxy

I have tried running the package/command through R studio But I keep runing into the same error

> install_github("ahmedmohamedali/eikonapir") > library(eikonapir) > data_frame = get_data(list("IBM", "GOOG.O", "MSFT.O"), list("TR.PriceClose", "TR.Volume", "TR.PriceLow"))

with the response

No encoding supplied: defaulting to UTF-8. Error in print.default("HTTP Error, code= ", response$status_code, sep = "") : invalid 'digits' argument

There is a proxy in my firm. In order to install package from GitHub, for example, I use

file.edit('~/.Renviron')
http_proxy ='http://username:password@serveradress:8080'
https_proxy ='http://username:password@serveradress:8080'

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonapireikon-data-api-rproxy
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

14 Answers

Upvote
Accepted
39.2k 75 11 27

It looks like the proxy settings in your .Renviron file are the culprit. With these proxy settings httr library used by eikonapir package to send HTTP requests to Eikon API Proxy forwards HTTP requests addressed to localhost to the remote proxy. The remote proxy returns these requests back to your machine, but now the request comes from the remote proxy rather than from the local machine and Eikon API Proxy rejects the request.
You need to find a way to bypass the proxy for requests sent to localhost. I'm afraid I cannot give you simple instructions, as there are too many variables here. It looks like you're using Mac. You may be able to configure proxy server in the Network settings rather than in .Renviron file. In this case in the same window you can configure bypassing proxy for localhost. You may simply comment out proxy settings in .Renviron file when retrieving data from Eikon and uncomment them when you need to download packages or retrieve other data from the Internet. There may be other ways to bypass the proxy for local addresses.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
39.2k 75 11 27
I don't see why these three lines of code would result in this error. Is it the last line that produces the error? Or is it the install_github function? Or is it some other part of your code?
This said I do have a couple of comments on these 3 lines:
  1. You only need to install eikonapir library once. There's no need to call install_github function every time you retrieve data from Eikon.
  2. After loading eikonapir library using library(eikonapir) function and before retrieving data from Eikon using get_data you need to call set_app_id with the app key created with App Key Generator app in Eikon application.
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

many thanks for the promot reply. For 1 , no , not install the eikonapi everytime. for 2 its

data_frame = get_data(list("IBM", "GOOG.O", "MSFT.O"), list("TR.PriceClose", "TR.Volume", "TR.PriceLow")) generating error and I suspect it's linked with port or proxy. I tried the code in a PC without company policy and it worked.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
39.2k 75 11 27

Before we start checking connectivity on the local port, please verify you call set_app_id method with a valid app key. get_data method cannot possibly return data unless you set correct app key. See the following previous thread on this forum.
https://community.developers.refinitiv.com/questions/28988/eikon-api-errors-in-previously-working-scripts.html

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

many thanks for this prompt post. I use app key generator to generate a new key and the situation remains.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

reading all the relevant post , I also tried "http://localhost:9000/api/v1/data" in my browser and it returns "Internal Server Error"

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
39.2k 75 11 27

Internal Server Error in response to HTTP GET request from the browser indicates that Eikon API Proxy is up and listening on port 9000. Could you try the following call and post the result?


               

get_data('TRI.N', 'TR.PriceClose', debug=TRUE, raw_output=TRUE)

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

hi Alex thanks for the quick response again . I got the following answer

No encoding supplied: defaulting to UTF-8.
[1] "Request *************************************"
{"Entity":{"E":["DataGrid"],"W":{"instruments":[["TRI.N"]],"fields":[{"name":["TR.PriceClose"]}]}}} 
[1] "Response *************************************"
[1] "<HEAD><TITLE>Request on loopback from external IP</TITLE></HEAD>\n<BODY BGCOLOR=\"white\" FGCOLOR=\"black\"><H1>Request on loopback from external IP</H1><HR>\n<FONT FACE=\"Helvetica,Arial\"><B>\nDescription: Your request is prohibited because the request is on loopback from external IP.</B></FONT>\n<HR>\n<!-- default \"Request on loopback from external IP\" response (400) -->\n</BODY>\n                                                                                                                                                                                                                                                                                                   "
[1] "Response status *************************************"
[1] 400
Error in print.default("HTTP Error, code= ", response$status_code, sep = "") : 
  invalid 'digits' argument
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

There is a proxy in my firm. In order to install package from GitHub, for example, I use

file.edit('~/.Renviron')
http_proxy ='http://username:password@serveradress:8080'
https_proxy ='http://username:password@serveradress:8080'

to pass the firewall

Upvote
39.2k 75 11 27

Interesting... Eikonapir package sends HTTP POST to localhost:9000/api/v1/data. This response means the HTTP POST received by Eikon API Proxy came from an external IP address. In other words the IP address of where the request came from is different from the IP address of the machine where Eikon API Proxy is running. I'm wondering what could possibly be causing this behavior, given that Eikonapir library sends the request to the localhost. Are you running in some sort of virtualized environment? Is this Windows or Mac? These are rather wild shots, but I'm afraid I don't see a simple and straightforward explanation for the behavior you experience. Have you modified the source code of Eikonapir package to send the requests to an external machine? Can you try "ping localhost" command (in Terminal on Mac) or "ping -4 localhost" (in Command Prompt on Windows) to see if localhost alias is mapped to the loopback IPv4 address (127.0.0.1).

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

Hi @Alex Putkov thanks a lot for this answer, very informative. I 'm running eikon on windows and have not changed the source code.

I have virtualized applications but I don't think Eikon is virtualized it is rather a local installation.

this is the ping result :

Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

could this external ip issue caused by having a corporate proxy?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

i tried

http://localhost:9000/ping?all

with following answer

{"port":9000,"mode":"eikon4","pid":4064,"hasSecure":true,"startedTime":"Thu Sep 05 2019 16:14:10 GMT+0200 (Romance Daylight Time)","subApps":[{"path":"/heap"},{"path":"/ping"},{"path":"/sxs","data":{"hasSecure":true,"sxsApps":{}}},{"path":"/api"}]}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

Thanks for @Alex Putkov 's detailed explaination and investigation. Commenting out Proxy , it works perfect.

here is the current workout thanks to @Alex Putkov:

Will comment out proxy setting in

file.edit('~/.Renviron')

e when using eikon and put back proxy setting each time when data retrieval is finished. A restart of Rstudio is required.

Probably there is a way to automate this process, but I 'm already extremely happy for the above. thanks

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 4

hi @Alex Putkov.

I have encountered today again a problem with a different error. it works perfect until this week


[1] "Request *************************************"

{"Entity":{"E":["DataGrid"],"W":{"instruments":[["IBM"],["GOOG.O"],["MSFT.O"]],"fields":[{"name":["TR.PriceClose"]},{"name":["TR.Volume"]},{"name":["TR.PriceLow"]}]}}}

[1] "Response *************************************"

[1] "{\"code\":500,\"message\":\"connect ETIMEDOUT 159.220.1.19:443\",\"statusMessage\":\"Internal Server Error\"}"

[1] "Response status *************************************"

[1] 500


http://localhost:9000/ping?all gives me

{"port":9000,"mode":"eikon4","pid":8908,"hasSecure":true,"startedTime":"Mon Nov 30 2020 13:20:23 GMT+0100 (Romance Standard Time)","subApps":[{"path":"/heap"},{"path":"/ping"},{"path":"/sxs","data":{"hasSecure":true,"sxsApps":{}}},{"path":"/api"},{"path":"/sxs/v1/services/messenger"}]}


and I also tried "http://localhost:9000/api/v1/data" in my browser and it returns "Internal Server Error"

what could be the issue?

many thanks for your precious help

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
39.2k 75 11 27

The error "{\"code\":500,\"message\":\"connect ETIMEDOUT 159.220.1.19:443\",\"statusMessage\":\"Internal Server Error\"}" indicates that the HTTP request sent to Eikon platform backend timed out. This could happen for any number of reasons. If the issue is intermittent and happens fairly rarely, the simple workaround is to resubmit the request when this specific error is encountered. It would be quite similar to typing a URL in an Internet browser to navigate to a Web page and not getting a response, then entering the URL again or refreshing the browser and getting the page displayed.
If the issue persists, then you need to report it to Refinitiv Helpdesk for investigation. Refinitiv Helpdesk can be reached by using Contact Us capability in your Eikon application or by visiting MyRefinitiv.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea