For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted
35 1 0 3

Error Code 2504- Occurs at random times in code, how is this error caused and how is it solved?

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonerror
error-gateway.png (21.6 KiB)
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
4.3k 2 4 5

Hi,

As you mention, this error could occur randomly.

A way to protect your code is to catch the exception then retry your request after a delay.

Ex:

from threading import Event
timer = Event()
...
while True:
    try:
        ts = ek.get_timeseries(...)
        break
    except ek.EikonError as err:
        if err.err_code != 2504:
            # request failed with other reason than 2504 error code
            break
        # let's retry after a delay
        timer.wait(1)

(timer.wait() is better than time.sleep())

icon clock
10 |1500

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

Hi,

I'm having the same issue. I'm retrying a few times, and still seeing either "Error code 2504 | UDF Core request failed. Gateway Time-out" or "Error code 500 | Backend error. 500 Internal Server Error". Would you know the reason why this occurs?

Also, could you please elaborate on why timer.wait() is preferable? Would switching from time.sleep() to timer.wait() help alleviate these issues?

Thank you,

Shashank

Click below to post an Idea Post Idea