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

Connecting to Eikon Data API

Ok, please forgive me but I have started playing with the Eikon Data API only today. I struggle. I struggle a lot more than I should for a modern product. I am using the Eikon Python API version 1.1.2

import eikon as ek
print(ek.__version__)

import logging
import http.client

http.client.HTTPConnection.debuglevel = 1

logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True

if __name__ == '__main__':
    ek.set_app_key('084xxxx')


The output is


1.1.2
INFO:pyeikon:Set App Key: None
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:9000
send: b'GET /api/v1/data HTTP/1.1\r\nHost: localhost:9000\r\nUser-Agent: python-requests/2.22.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nx-tr-...


DEBUG:urllib3.connectionpool:http://localhost:9000 "GET /api/v1/data HTTP/1.1" 307 40
reply: 'HTTP/1.1 307 Temporary Redirect\r\n'
header: Access-Control-Allow-Origin: *
header: X-ID: 17264.18
header: Location: /api/
header: Vary: Accept
header: Content-Type: text/plain; charset=utf-8
header: Content-Length: 40
header: Date: Fri, 08 May 2020 19:54:48 GMT
header: Connection: keep-alive
send: b'GET /api/ HTTP/1.1\r\nHost: localhost:9000\r\nUser-Agent: python-requests/2.22.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nx-tr-applicationid: ...


reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Access-Control-Allow-Origin: *
header: X-ID: 17264.19
header: Vary: Accept
header: Content-Type: application/json; charset=utf-8
header: Content-Length: 89
header: ETag: W/"59-ZI4k3svYPlZanax9D9COXoCzgcA"
header: Date: Fri, 08 May 2020 19:54:48 GMT
header: Connection: keep-alive
send: b'POST /api/handshake HTTP/1.1\r\nHost: localhost:9000\r\nUser-Agent: python-requests/2.22.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nx-tr-applicationid: ….\r\nContent-Type: application/json\r\nContent-Length: 113\r\n\r\n'
send: b'{"id": "Profile.py_handshake[]", "client": {"id": "EikonPython", "version": "1.1.2", "supportedApiVersion": "1"}}'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Access-Control-Allow-Origin: *
header: X-ID: 17264.20
header: X-Request-Id: 5c4c3392-a9e1-41a9-8bdd-b558245fb4ce
header: Content-Type: text/html; charset=utf-8
header: Content-Length: 29
header: ETag: W/"1d-dBJHQM36p6JwbM9yZqLeYlV64ds"
header: Date: Fri, 08 May 2020 19:54:48 GMT
header: Connection: keep-alive
DEBUG:urllib3.connectionpool:http://localhost:9000 "GET /api/ HTTP/1.1" 500 89
INFO:pyeikon:Response : 500 - {"code":500,"message":"Cannot find module \".\"","statusMessage":"Internal Server Error"}
INFO:pyeikon:Port 9000 was retrieved from .portInUse file
INFO:pyeikon:Try to handshake on url http://localhost:9000/api/handshake...
DEBUG:urllib3.connectionpool:http://localhost:9000 "POST /api/handshake HTTP/1.1" 400 29
INFO:pyeikon:Response : 400 - Handshake payload is invalid.
INFO:pyeikon:Set Proxy port number to 9000
INFO:pyeikon:Checking port 9000 response : 500 - {"code":500,"message":"Cannot find module \".\"","statusMessage":"Internal Server Error"}
INFO:pyeikon:Port 9000 was retrieved from .portInUse file
INFO:pyeikon:Try to handshake on url http://localhost:9000/api/handshake...
INFO:pyeikon:Response : 200 - ...


INFO:pyeikon:Application ID: 084...
INFO:pyeikon:Port 9000 on local proxy was detected





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.

1 Answer

· Write an Answer
Upvotes
Accepted
39.4k 77 11 27

I'm not sure what you're struggling with. From the log it looks like you've successfully established connection with Eikon API Proxy. The following line in the log indicates successful response to the handshake request, and I assume the response contains the session token, which will be used by Eikon Data APIs library and which you omitted in your post. So, what's the problem?

INFO:pyeikon:Response : 200 - ... 
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.

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.