Cannot open.session() for refinitiv.data API

I am trying to use the below function to access the daily market prices from the refinitiv data API. However, at session.open() I get an error - in the _utils.py, " ValueError: Proxy keys should use proper URL forms rather than plain scheme strings. instead of "qualys_http", user "qualys_http://"


Can some one help me with resolving this issue. Thanks.

1706286586129.png

Error

1706286924504.png

Best Answer

  • Jirapongse
    Answer ✓

    @pulara.mapatuna

    It shouldn't relate to the Refinitiv Data Library. It could be the problem in the Python environment. You can test the connection with the following code.

    import requests
    url = "https://api.refinitiv.com/auth/oauth2/v1/token"
    payload = 'username=<username>&password=<password>&grant_type=password&scope=trapi&takeExclusiveSignOnControl=true&client_id=<client_id>'
    headers = {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
    response = requests.request("POST", url, headers=headers, data=payload)
    print(response.text)

Answers