Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 1 1

Python API runs indefinitely without a response

Hello, I am having problems with the function ek.get_data(). When I do a request no error message or data is returned and the code keeps running indefinitely without a response. Could someone help me with this issue?

Thanks

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
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.

@rone.almeida

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Hello @rone.almeida ,

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
22.1k 59 14 21

I don't see the log level command before set_app_key call. Did you invoke it?

ek.set_log_level(logging.DEBUG)

Can you also please follow all the steps in this troubleshooting article to see if it gets any better.

I also wanted to mention, that these forums are development support only. We do not have any visibility into the servers/operations support. If it comes to that, you will have to open a support ticket at my.refinitiv.com.

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
24.7k 54 17 14

Hello @rone.almeida

Could you please share your snippet code and the versions of Python/Eikon Data API?

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 0 1 1

This is my code:

datas, err = ek.get_data(['.BVSP'],

['TR.PriceClose.date','TR.PriceClose'],

{'SDate': '2021-04-29', 'EDate':'2021-04-30', 'FRQ': 'D'})


Last week, this code was running normally. Python version is 3.9.5 and Eikon version is 4.0.53072.

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
22.1k 59 14 21

Hello @rone.almeida,

There is nothing wrong with your API query. Can you try restarting your computer and Eikon and try again. You can also enable logging on the system to capture the raw requests and responses from Eikon. Use something like this, and it should pinpoint the problem area:

import logging.config
import eikon as ek

ek.set_log_level(logging.DEBUG)

ek.set_app_key('**app key**')
datas, err = ek.get_data(['.BVSP'], ['TR.PriceClose.date','TR.PriceClose'], {'SDate': '2021-04-29', 'EDate':'2021-04-30', 'FRQ': 'D'})

The output should be something like:

20..2] Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...
20..2] Request to http://127.0.0.1:9060/api/status        headers = {'x-tr-applicationid': '***'}        params = None
20..2] Checking port 9060 response : 200 - {"statusCode":"ST_PROXY_READY","version":"2.8.0"}
20..2] Port 9060 was retrieved from .portInUse file
20..2] Try to handshake on url http://127.0.0.1:9060/api/handshake...
20..2] Request to http://127.0.0.1:9060/api/handshake        headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '***'}        params = None
20..2] Response : 200 - {"access_token":"****","expires_in":1209600,"token_type":"bearer"}
20..2] Application ID: ***
20..2] Init a Desktop session with new app_key
20..2] Port 9060 on local proxy was detected
20..2] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['.BVSP'], 'fields': [{'name': 'TR.PriceClose.date'}, {'name': 'TR.PriceClose'}], 'parameters': {'SDate': '2021-04-29', 'EDate': '2021-04-30', 'FRQ': 'D'}}]}}}
20..2] Request to http://127.0.0.1:9060/api/v1/data        headers = {'Content-Type': 'application/json', 'x-tr-applicationid': '***', 'Authorization': 'Bearer ****'}        params = None
20..2] HTTP Response code: 200
20..2] HTTP Response: {"responses":[{"columnHeadersCount":1,"data":[[".BVSP","2021-04-29T00:00:00Z",120065.75],[".BVSP","2021-04-30T00:00:00Z",118893.84]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Date","field":"TR.PRICECLOSE.DATE"},{"displayName":"Price Close","field":"TR.PRICECLOSE"}]],"rowHeadersCount":1,"totalColumnsCount":3,"totalRowsCount":3}]}



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
22.1k 59 14 21

I should also add that you can try to use the Codebook app in the Eikon to try your script in a cloud hosted jupyer environment.

Type in Codebook in Eikon desktop to launch it, or see this article for more details.

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 0 1 1

I restarted my computer and Eikon and still it isn´t getting any response. Even the ek.set_app_key() is not working (Picture attached). Could you guys check your server?


error.png (6.2 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.

Upvotes
1 0 1 1

I tried to run this code:

screener_exp = 'SCREEN(U(IN(Equity(active or inactive,public))),IN(TR.ExchangeCountryCode,"BR"), CURN=USD)'

companies_data, err = ek.get_data(instruments=[screener_exp], fields=['TR.InstrumentType','TR.CommonName','TR.PriceClose.date'])


And I got this output:


1620251821326.png (32.2 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.

@rone.almeida

I can run it properly.


1625458457115.png

What is the version of Python you are using?

Please run the 'pip list" command to verify the versions of Python Libraries used by the machine.

1625458457115.png (124.2 KiB)

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.