Python WebSocketAPI Proxy Settings

terapon1
terapon1 Newcomer
edited March 21 in WebSocket API

In the "market_price_rto_authentication.py" example on GITHUB, how do I configure proxy settings inside the code? I am running the code inside an organization network. The error received is below.

Sending authentication request with password to https://api.refinitiv.com:443/auth/oauth2/v1/token ...
LSEG Delivery Platform authentication exception failure: HTTPSConnectionPool(host='api.refinitiv.com', port=443): Max retries exceeded with url: /auth/oauth2/v1/token (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000021BCBEB6F90>, 'Connection to api.refinitiv.com timed out. (connect timeout=None)'))
An exception has occurred, use %tb to see the full traceback.

Answers

  • terapon1
    terapon1 Newcomer

    Also in the "market_price_rto_authentication.py" example, I have to input

    --user <username> , for this username is it the username I logged in to this developer community account?

    --password <password> , for this passwrod is it the password I logged in to this developer community account?

    --clientid <clientid> , I have this parameter.

    --hostname <LSEG Real-Time Service host> , what should the host name be?

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @terapon1

    Thank you for reaching out to us.

    You need to check how to set the proxy in Python or in the third party libraries (requests and websocket).

    You can refer to the following article.

  • Hello @terapon1

    It is better to use the Service Discovery example. The username and password are the credentials for the RTO - which your LSEG account manager can provide. See this getting started guide for the step by step process.

    The Python websockets-client module used in these examples, uses httpx for communication. Setting the following environment variables should route the network traffic through the proxy server:

    set https_proxy=http://proxy_host:proxy_port