Errors while requesting data using eikon and refinitiv-data librairies

Hi, while trying to get data from eikon API , I am getting the followings errors :

#using eikon library :

import eikon as ek

ek.set_app_key('DEFAULT_CODE_BOOK_APP_KEY')

import json

df = ek.get_timeseries(['EUR='],start_date="2023-11-24",end_date="2023-11-27")

print(df)


error : Error code 403 | Client Error: Forbidden by proxy


#using refinitiv.data library

import refinitiv.data as rd

rd.open_session()

df = rd.get_data(universe = ['EUR='],fields = ['CF_CLOSE'] )

print(df)


error : refinitiv.data._errors.RDError: Error code -1 | Cannot load the list of associated URLs from http://localhost:9060/api/rdp/streaming/pricing/v1/ for apis.streaming.pricing.endpoints.main endpoint.


I tried to test the scripts above using Codebook and it works fine.


any help please ? Thanks.

Best Answer

  • raksina.samasiri
    Answer ✓

    Hi @malaouiismaili ,

    The log you attached mentioned that 'Your Internet experience is protected by Clearswift' which is blocking the connection to the Data API Proxy. Could you please check with your internal IT team to allow connection to localhost to be able to connect to the API proxy.

    [2023-11-30T14:40:33.226458+01:00] - [sessions.desktop.workspace.0] - [DEBUG] - [15616 - MainThread] - [connection] - [debug] - Checking proxy url http://localhost:9005/api/status response : 403 -

    To set app key when using RD library,

    rd.open_session(app_key = 'YOUR_APP_KEY)

    Hope this helps and please let me know in case you have any further questions

Answers

  • @malaouiismaili

    Thank you for reaching out to us.

    The Eikon Data API uses the 127.0.0.1 address to connect to the API proxy.

    According to the error (error : Error code 403 | Client Error: Forbidden by proxy), this address may be blocked by your network settings. You may try to run the following code at the beginning.

    import os
    os.environ['NO_PROXY'] = 'localhost'
    os.environ['NO_PROXY'] = '127.0.0.1'

    Regarding the RD library, you can try the following code.

    rd.get_history(universe="EUR=",
                   count=10, 
                   interval='1D',
                   fields = ["BID", "BID_HIGH_1", "BID_LOW_1", "OPEN_BID", "NUM_BIDS"])


  • Thank you @Jirapongse.

    I tried your code and I am getting the following error :

    refinitiv.data._errors.RDError: Error code -1 | No data to return, please check errors: ERROR: No successful response.

    Any suggestions ? Thanks again

  • Hi @Jirapongse , all scripts are working well for @malaouiismaili in CODEBOOK, but it returns errrors while running via cmd or another IDE. Would you be able to help or is it internall user's issue which should be solved by local IT?

  • @malaouiismaili

    You can enable logging in the RD library to verify the behavior by using the following code.

    import refinitiv.data as rd
    rd.get_config()["logs.level"] = "debug"
    rd.get_config()["logs.transports.file.enabled"] = True
    rd.get_config()["logs.transports.file.name"] = "refinitiv-data-lib.log"
    rd.open_session()

    Then, check the refinitiv-data-lib.log file.

  • @lukasz.trzcinski0

    They are different environments.

    The client can enable the debug log in the library to verify what the problem is.

  • Hello,

    Thanks again for your answer.

    I tested the following code like you suggested with debug mode :

    import os
    import refinitiv.data as rd
    os.environ['NO_PROXY'] = 'localhost'
    os.environ['NO_PROXY'] = '127.0.0.1'
    rd.get_config()["logs.level"] = "debug"
    rd.get_config()["logs.transports.file.enabled"] = True
    rd.get_config()["logs.transports.file.name"] = "refinitiv-data-lib.log"


    rd.open_session()
    df = rd.get_history(universe="EUR=",
    count=10,
    interval='1D',
    fields = ["BID", "BID_HIGH_1", "BID_LOW_1", "OPEN_BID", "NUM_BIDS"])
    print(df)

    Please find the log file below (I changed the extension to .txt, so it can uploaded)

    20231130-1440-8968-refinitiv-data-lib.txt

    Also, can I please know if we have to set the APP KEY when using refenitiv-data librairy, like we used to do with the eikon one (ek.set_app_key('DEFAULT_CODE_BOOK_APP_KEY') ?



  • Hi again,

    I checked the issue with our local IT team.

    They need the list of API adresses, so they can unblock them.

    Many thanks,


  • Hello @malaouiismaili

    The proxy is the local Workspace/Eikon desktop application, so the IP Address is 127.0.0.1 (localhost) like @Jirapongse mentioned in the first comment.

    For the IP Address of the RDP endpoint, they are as follows:

    • 75.2.0.254
    • 99.83.242.11
  • Hi again,

    Do you have any idea please why I'am getting this error ?

    sh.png

    And when checking this URL via Chrome :

    api.png


    Thanks in advance !