eikon get_data never returning anything. no error message either.

Hi,

I am using python-3.8.3, eikon-1.1.6.post3 and PyCharm IDE

import eikon as ek # Works fine
ek.set_app_key('xxxx') # It takes like 10 secondes for the command prompt to return
df, err = ek.get_data('AAPL.O', ['TR.PriceClose']) # The command prompt never returns. No error message either.

Best Answer

  • pf
    pf LSEG
    Answer ✓

    Could you add following env variable :
    HTTPX_LOG_LEVEL=trace

    with PyCharm, add it in scrip environment as below:

    image

    then run your script and check if there is any error/warning or anything that could explain frozen request.

    You should have additional HTTP logs like this:

    TRACE [2020-09-29 00:12:09] httpx._config - load_verify_locations cafile=C:\Python\38\lib\site-packages\certifi\cacert.pem
    ...
    DEBUG [2020-09-29 00:12:23] httpx._client - HTTP Request: POST http://localhost:9060/api/udf "HTTP/1.1 200 OK"
    2020-09-29 00:12:23,604 P[12736] [MainThread 37772] HTTP Request: POST http://localhost:9060/api/udf "HTTP/1.1 200 OK"
    TRACE [2020-09-29 00:12:23] httpcore._async.http11 - receive_event=Data(<258 bytes>)
    2020-09-29 00:12:23,604 P[12736] [MainThread 37772] receive_event=Data(<258 bytes>)
    TRACE [2020-09-29 00:12:23] httpcore._async.http11 - receive_event=EndOfMessage(headers=[])
    2020-09-29 00:12:23,604 P[12736] [MainThread 37772] receive_event=EndOfMessage(headers=[])
    TRACE [2020-09-29 00:12:23] httpcore._async.http11 - response_closed our_state=DONE their_state=DONE

    2020-09-29 00:12:23,604 P[12736] [MainThread 37772] response_closed our_state=DONE their_state=DONE

Answers

  • Hi,

    Could you activate log (ek.set_log_level(10)), then execute your get_data() request and share the trace ?

    Take care to hide your app_key renamed as application_id (see below)

    You should have this :

    df, err = ek.get_data('AAPL.O', ['TR.PriceClose'])

    2020-09-27 18:08:38,342 P[3412] [MainThread 19428] entity: DataGrid_StandardAsync
    2020-09-27 18:08:38,343 P[3412] [MainThread 19428] payload: {'requests': [{'instruments': ['AAPL.O'], 'fields': [{'name': 'TR.PriceClose'}]}]} 2020-09-27 18:08:38,344 P[3412] [MainThread 19428] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['AAPL.O'], 'fields': [{'name': 'TR.PriceClose'}]}]}}}
    2020-09-27 18:08:38,347 P[3412] [MainThread 19428] Request to http://localhost:9060/api/v1/data
        headers = {'Content-Type': 'application/json', 'x-tr-applicationid': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6IjFmZGYwNmFmMTU3NjRkYzc5ZTI3ZmE0NzYwYmI3NzQ2NDY0MmU4ZjgiLCJBcHBTY29wZSI6InJhcGkiLCJMaWJyYXJ5TmFtZSI6IkVpa29uIFB5dGhvbiBMaWJyYXJ5IiwiTGlicmFyeVZlcnNpb24iOiIxLjEuNi5wb3N0MyIsImlhdCI6MTYwMTIyMjcwNiwiZXhwIjoxNjAyNDMyMzA2fQ.eYL6BIwpSDR0qNEpcfEg83zZzV_FSREIgYwqnT23D1Y'}     params = None
    2020-09-27 18:08:40,208 P[3412] [MainThread 19428] HTTP request response 200: {"responses":[{"columnHeadersCount":1,"data":[["AAPL.O",112.28]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Price Close","field":"TR.PRICECLOSE"}]],"rowHeadersCount":1,"totalColumnsCount":2,"totalRowsCount":2}]}
    2020-09-27 18:08:40,209 P[3412] [MainThread 19428] HTTP Response code: 200
    2020-09-27 18:08:40,210 P[3412] [MainThread 19428] HTTP Response: {"responses":[{"columnHeadersCount":1,"data":[["AAPL.O",112.28]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"Price Close","field":"TR.PRICECLOSE"}]],"rowHeadersCount":1,"totalColumnsCount":2,"totalRowsCount":2}]}
    2020-09-27 18:08:40,210 P[3412] [MainThread 19428] Response size: 327
    df
    Out[4]:
    InstrumentPrice Close0AAPL.O112.28


  • Hi @pierre.faurel


    import eikon as ek

    ek.set_log_level(10)

    ek.set_app_key('xxxx')

    2020-09-28 10:21:46,896 P[1536] [MainThread 10500] Send GET request to http://localhost:9060/api/status to detect API Proxy...

    2020-09-28 10:21:46,897 P[1536] [MainThread 10500] Request to http://localhost:9060/api/status

    headers = {'x-tr-applicationid': 'xxxx'}

    params = None

    2020-09-28 10:21:56,934 P[1536] [MainThread 10500] Checking port 9060 response : 200 - {"statusCode":"ST_PROXY_READY","version":"2.6.0"}

    2020-09-28 10:21:56,935 P[1536] [MainThread 10500] Port 9060 was retrieved from .portInUse file

    2020-09-28 10:21:56,935 P[1536] [MainThread 10500] Try to handshake on url http://localhost:9060/api/handshake...

    2020-09-28 10:21:56,945 P[1536] [MainThread 10500] Request to http://localhost:9060/api/handshake

    headers = {'Content-Type': 'application/json', 'x-tr-applicationid': 'xxxx'}

    params = None

    2020-09-28 10:21:57,091 P[1536] [MainThread 10500] Response : 200 - {"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6ImU0Y2M4MWFjYmQxNTQxZjZhMWY1MmE4ZDQ5NzRmMmI5MjM4NzZjZTYiLCJBcHBTY29wZSI6InJhcGkiLCJMaWJyYXJ5TmFtZSI6IkVpa29uIFB5dGhvbiBMaWJyYXJ5IiwiTGlicmFyeVZlcnNpb24iOiIxLjEuNi5wb3N0MyIsImlhdCI6MTYwMTI4NDkxNywiZXhwIjoxNjAyNDk0NTE3fQ._tTSpU37U0pQ585CkrFnXgJ1LPU3X6OfbkB0Iwn2zEU","expires_in":1209600,"token_type":"bearer"}

    2020-09-28 10:21:57,091 P[1536] [MainThread 10500] Application ID: xxxx

    2020-09-28 10:21:57,092 P[1536] [MainThread 10500] Init a Desktop session with new app_key

    2020-09-28 10:21:57,092 P[1536] [MainThread 10500] Port 9060 on local proxy was detected

    df, err = ek.get_data("AAPL.O", ["TR.PriceClose"])

    2020-09-28 10:22:03,896 P[1536] [MainThread 10500] Request:{'Entity': {'E': 'DataGrid_StandardAsync', 'W': {'requests': [{'instruments': ['AAPL.O'], 'fields': [{'name': 'TR.PriceClose'}]}]}}}

    2020-09-28 10:22:03,896 P[1536] [MainThread 10500] Request to http://localhost:9060/api/v1/data

    headers = {'Content-Type': 'application/json', 'x-tr-applicationid': 'xxxx', 'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcGlWZXJzaW9uIjoiMSIsIkFwcEtleSI6ImU0Y2M4MWFjYmQxNTQxZjZhMWY1MmE4ZDQ5NzRmMmI5MjM4NzZjZTYiLCJBcHBTY29wZSI6InJhcGkiLCJMaWJyYXJ5TmFtZSI6IkVpa29uIFB5dGhvbiBMaWJyYXJ5IiwiTGlicmFyeVZlcnNpb24iOiIxLjEuNi5wb3N0MyIsImlhdCI6MTYwMTI4NDkxNywiZXhwIjoxNjAyNDk0NTE3fQ._tTSpU37U0pQ585CkrFnXgJ1LPU3X6OfbkB0Iwn2zEU'}

    params = None

  • I think that your comment was cutted because of the lenght.
    Just last lines from "2020-09-28 10:22:03,896 P[1536] [MainThread 10500] Request to http://localhost:9060/api/v1/data " are the more meaningful

    ... or are you stucked on the request without response ?

  • @pierre.faurel Is there know issues with python-3.8 and the Eikon API? Shall I just downgrade to python-3.7?

  • There were an issue with Python 3.8 and eikon 1.1.6 but it was fixed with last update 1.1.6.post3 (your log show that the issue disappeared, otherwise you won' have "Port 9060 on local proxy was detected" message).

    Could you list all lib versions in your Python env ?
    (you can get it with "pip list" command or from PyCharm/Settings/Project interpreter window)