set_app_key handshake

Hello, after having set an app key, I am trying the python eikon package.

python 3.8.13

eikon 1.1.16

httpx 0.24.1 (putting it there as I saw that this package was of importance).

I am working behind a proxy, windows environment.

I tried to relog on / log off my eikon session and tried with a new app key but nothing happened.


I can access https://emea1.apps.cp.thomsonreuters.com/ via my web browser.


Code:

import eikon as ek

app_key = "my_app_key"
ek.set_app_key(api_key)


2023-06-12 13:11:36,517 P[26600] [MainThread 39472] Reset a Desktop session with new app_key
2023-06-12 13:11:36,561 P[26600] [MainThread 39472] Send GET request to http://127.0.0.1:9060/api/status to detect API Proxy...
2023-06-12 13:11:36,597 P[26600] [MainThread 39472] Request to http://127.0.0.1:9060/api/status
headers = {'x-tr-applicationid': 'my_app_key'}
params = None
2023-06-12 13:11:36,640 P[26600] [MainThread 39472] Checking proxy url http://127.0.0.1:9060/api/status response : 200 - {"statusCode":"ST_PROXY_READY","version":"3.3.11-eikon4"}
2023-06-12 13:11:36,673 P[26600] [MainThread 39472] Port 9060 was retrieved from .portInUse file
2023-06-12 13:11:36,706 P[26600] [MainThread 39472] Try to handshake on url http://127.0.0.1:9060/api/handshake...
2023-06-12 13:11:36,738 P[26600] [MainThread 39472] Request to http://127.0.0.1:9060/api/handshake
headers = {'Content-Type': 'application/json', 'x-tr-applicationid': 'my_app_key'}
params = None
2023-06-12 13:11:51,784 P[26600] [MainThread 39472] Error on handshake url http://127.0.0.1:9060/api/handshake : ReadTimeout('')
2023-06-12 13:11:51,821 P[26600] [MainThread 39472] Error on handshake url http://127.0.0.1:9060/api/handshake : ReadTimeout('')
2023-06-12 13:11:51,854 P[26600] [MainThread 39472] Port number was not identified, cannot send any request
2023-06-12 13:11:51,883 P[26600] [MainThread 39472] Init a Desktop session with new app_key


When I look at the URL http://127.0.0.1:9060/api/handshake it returns a json with code: 404

Best Answer

  • Jirapongse
    Answer ✓

    @charles.cadestin

    Thank you for reaching out to us.

    You can test the request by running the following command in PowerShell.

    (Invoke-WebRequest -Method POST -Body (@{"AppKey"="<app key>";"AppScope"="trapi";"ApiVersion"="1";"LibraryName"="RDP Python Library";"LibraryVersion"="1.1.7"}|ConvertTo-Json) -Uri http://127.0.0.1:9060/api/handshake -ContentType application/json)

    Change "<app key>" to your application key.

    The response looks like this:

    1686623166533.png

Answers

  • Thank you very much for your prompt answer!

    So the code returns a code error 500 that seems to indicate I don't have access.

    PS G:\> (Invoke-WebRequest -Method POST -Body (@{"AppKey"="my_app_key";"AppScope"="trapi";"ApiVersion"="1";"LibraryName"="RDP Python Library";"LibraryVersion"="1.1.7"}|ConvertTo-Json) -Uri http://127.0.0.1:9060/api/handshake -ContentType application/json)
    Invoke-WebRequest : {"code":500,"message":"connect ETIMEDOUT 159.220.1.19:443","statusMessage":"Internal Server Error"}
    At line:1 char:2
    + (Invoke-WebRequest -Method POST -Body (@{"AppKey"="my_app_key ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand