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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted
16 1 1 3

Why does this get_data script fail?

Why does this script fail? x is a list with 200 RICs and attributes contains 22 fields. It even fails with chunksize=1.

chunksize = 5
i=0
w,err=ek.get_data(x[i:i+chunksize], attributes, { 'SDate': 0, 'EDate': -5, 'FRQ': 'FY', 'Curn': 'EUR'})    
with open('SAMPLE.csv', 'a') as f:
        w.to_csv(f, sep=';',decimal=',')
for i in range (chunksize, len(x), chunksize):
    print(i)
    w,err=ek.get_data(x[i:i+chunksize], attributes, { 'SDate': 0, 'EDate': -5, 'FRQ': 'FY', 'Curn': 'EUR'})
    with open('SAMPLE.csv', 'a') as f:
        w.to_csv(f,  sep=';',decimal=',',header=False)

returns

5
10
15
20
Backend error. 400 Bad Request

Looking forward to your comments.

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
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.

Upvotes
Accepted
18k 21 12 20

Hi @mbp

Please refer to this guideline.

And read "What happens when a limit is reached?" section.

Basically, I believe that you are sending request too often.

You should add some delay between each requests.

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.

Upvotes
16 1 1 3

I know why. The time-out occurs at no. 21. Do you know how to make an exception handler, so it continues through the list?

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.

Upvotes
39.2k 75 11 27

@mbp
If you randomly experience an issue with data requests returning "Backend error. 400 Bad Request", first see my answer on this thread.
For the answer about how to catch exceptions when using get_data method see this thread.

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.

Click below to post an Idea Post Idea