question

Upvotes
Accepted
1 1 1 1

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


#technologyrdp-api
sample-code.png (60.4 KiB)
icon clock
10 |1500

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

Hi @milan.gurung ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text on the left side of the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvotes
Accepted
5k 16 2 7

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

icon clock
10 |1500

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

Hi Haykaz,

Sharing log output for your review please.

Any suggestion please?

Thanks,

Milan


Uploading back the logs after removing the credentials

log-output.txt

log-output.txt (3.9 KiB)

Hi @milan.gurung ,


Looking at the logs I can see that the error occurred while requesting URL('https://api.refinitiv.com/auth/oauth2/v1/token'). So, while I will double check with our team, I would advice you checking with your team if you are blocking the URL.


Best regards,

Haykaz

Much appreciated Haykaz. I will keep you posted with update. Thanks.


Upvotes
22.1k 59 14 21

Hi @milan.gurung,

As pointed out by Haykaz, the default firewall settings in AWS block all the ports. Please have your admin configure the AWS security group to allow outgoing connections to following IP address on port 443.


DNS Records for api.refinitiv.com
Hostname          Type    TTL    Priority    Content
api.refinitiv.com    A    288                99.83.242.11
api.refinitiv.com    A    288                75.2.0.254


icon clock
10 |1500

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

Upvotes
1 1 1 1

Thank you Haykaz, Gurpreet.
Once fire wall settings have been configured by our Firewall security engineer, our app is able to make a successful call to the end point.

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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