ConnectError('[Errno 104] Connection reset by peer') while trying to call RDP API

Hi,

I have got a Python/Django Web application hosted in AWS. The app attempts to make a call to this API "https://api.refinitiv.com/discovery/searchlight/v1/" using Python package "refinitiv-data==1.1.0".

The application works perfectly fine running locally in my development machine. Unfortunately, when deployed to AWS, I am getting following error..

"
An error occurred while requesting URL('https://api.refinitiv.com/auth/oauth2/v1/token').

ConnectError('[Errno 104] Connection reset by peer')

[Error 0 - None] [Errno 104] Connection reset by peer

Session is not opened. Can't send any request

"

connection-error.png

Here is my code,

Note: settings.SEARCHLIGHT_URL = "https://api.refinitiv.com/discovery/searchlight/v1/"

sample-code.png



Any pointer would be much appreciated? Is it something to do with our corporate Firewall?


Many Thanks,


Milan


Best Answer

  • aramyan.h
    aramyan.h admin
    Answer ✓

    Hi @milan.gurung ,


    Thank you for your question. As the error suggests, the session is not opened, which might or might not be related with the Firewall. To investigate the session issue I would advice Diagnosing that using the following code:

    import logging.config
    session.set_log_level(logging.DEBUG)
    session.open()
    # To set logging back to default value
    session.set_log_level(logging.WARNING)

    To enable the logs in the console, please use:

    rd.get_config().set_param(
    param=f"logs.transports.console.enabled", value=True
    )


    Hope this helps, feel free to share the log output if you would want us to investigate the issue further.


    Best regards,

    Haykaz

Answers