New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
5 3 3 7

[WinError 10061] No connection could be made because the target machine actively refused it

I had this weird issue from the new Python API for workspaces.


Error using get_history_func>get_history (line 206)

Python Error: RDError: Error code -1 | [WinError 10061] No connection could be made because the target machine actively refused it


It doesn't happen all the time but frequently and last for 2-3 days (maybe longer some times)

Any insight about what causes this problem and how to avoid it ?



pythonworkspace-data-api#technology#productapi
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
Accepted
7.5k 18 2 8

Hi @xuewei.zhu ,


There might be several reasons for the error, so the logs and screenshot of the error would really help. However, in your code it seems you are trying to connect via platform session and you define it well. However, rd.open_session() may connect to desktop session. Since you are in desktop session, you may get the issue because of Workspace not running on the background or exceeding API limits enforced by the Workspace API proxy. Consider using the following code when you try connect via platform session:

session = rd.session.platform.Definition(
    app_key = APP_KEY, 
    grant = rd.session.platform.GrantPassword(
        username = RDP_LOGIN, 
        password = RDP_PASSWORD
    )
).get_session()
 
session.open()
 
rd.session.set_default(session)

Hope this helps.


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.

Upvotes
7.5k 18 2 8

Hi @xuewei.zhu ,


Could you please share the code you are using and the screenshot of the error so we investigate it further? Also, please find the troubleshooting guide which might be helpful to debug the issue -

Eikon Data API(Python) Troubleshooting | Refinitiv | Devportal (lseg.com)

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.

Upvotes
5 3 3 7

I used very simple code of line to download the data

session = rd.session.platform.Definition(

app_key = APP_KEY,

grant = rd.session.platform.GrantPassword(

username = RDP_LOGIN,

password = RDP_PASSWORD

)

).get_session()

rd.open_session()

data = rd.get_history(universe = tickers, fields = fieldnames, interval = time_interval, start = startDate, end = endDate)


It only gives this error sometimes, most of the time it's working fine.


I am not able to replicate the problem at the moment but I can certainly try to use the debug mode to save the log which may give more information.

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
5 3 3 7

Thanks for the explanation. I will definitely try to get the log file next time when I have this error.

Do you know what the API limits are?

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.

sure, you can find it here - Documentation | Devportal (lseg.com). Although you may see Eikon there, those are applicable to RD via desktop session as well since those limits are enforced by the same Desktop proxy both libraries are using.

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.