For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
7 2 1 1

SSL Unknown Protocol Error - Elektron WebSocket API - executing market_price_edpgw_authentication.py

Executing market_price_edpgw_authentication.py python code after creating AWS EC2 instance using Refinitiv AMI. Getting the below error.


('Sending authentication request with password to', 'https://api.refinitiv.com:443/auth/oauth2/beta1/token', '...')

EDP-GW Authentication succeeded. RECEIVED:

{

"access_token":"<access token>",

"expires_in":"300",

"refresh_token":"438e85ed-3a10-42d5-b07c-e49a1a3d0525",

"scope":"trapi.data.average-volume-analytics.ava_read trapi.data.historical-pricing.events.read trapi.data.historical-pricing.summaries.read trapi.data.quantitative-analytics.read trapi.messenger trapi.sdbold trapi.search.lookup.read trapi.search.metadata.read trapi.search.read trapi.user-framework.mobile.crud trapi.user-framework.recently-used.crud trapi.user-framework.workspace.crud",

"token_type":"Bearer"

}

Connecting to WebSocket wss://ec2-13-234-31-251.ap-south-1.compute.amazonaws.com:22/WebSocket ...

[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:727)

WebSocket Closed

refinitiv-realtimeelektron-sdktreprdp-apiwebsocketsrrto
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.

Upvote
Accepted
45.2k 103 44 60

@Sundeep.Tariyal

ec2-13-234-31-251.ap-south-1.compute.amazonaws.com looks like to be a hostname of your AWS EC2 machine. To run market_price_edpgw_authentication.py, you need to specify the hostname of the EDP-RT machine. It looks like amer-1.pricing.streaming.edp.thomsonreuters.com and the TCP port is 443.

Otherwise, you can use the market_price_edpgw_service_discovery.py example. For more information, please refer to the following links:

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.

I tried to get hostname and port using service discovery example but ran into an error. I am using AWS free tier account and Refinitiv AMI, so I suppose I should have permission for real time streaming.

"refresh_token":"b43c8b7e-948e-4664-8306-235d86dbd8ac",

"scope":"trapi.data.average-volume-analytics.ava_read trapi.data.historical-pricing.events.read trapi.data.historical-pricing.summaries.read trapi.data.quantitative-analytics.read trapi.messenger trapi.sdbold trapi.search.lookup.read trapi.search.metadata.read trapi.search.read trapi.user-framework.mobile.crud trapi.user-framework.recently-used.crud trapi.user-framework.workspace.crud",

"token_type":"Bearer"

}

Sending EDP-GW service discovery request to https://api.refinitiv.com/streaming/pricing/v1/

('EDP-GW service discovery HTTP code:', 403, 'Forbidden')

Stop trying with the request

Failed to retrieve endpoints from EDP Service Discovery. Exiting...

Upvote
9.5k 10 5 7

Hello @Sundeep.Tariyal

It seems that your are trying to connect to the server which may not support WebSocket transport; ec2-13-234-31-251.ap-south-1.compute.amazonaws.com and port 22.

You can find WebSocket host and port by running market_price_edpgw_service_discovery.py. The output is service discovery in each region that you should be able to connected to.

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.

I tried to get hostname and port using service discovery example but ran into an error. I am using AWS free tier account and Refinitiv AMI, so I suppose I should have permission for real time streaming.

"refresh_token":"b43c8b7e-948e-4664-8306-235d86dbd8ac",

"scope":"trapi.data.average-volume-analytics.ava_read trapi.data.historical-pricing.events.read trapi.data.historical-pricing.summaries.read trapi.data.quantitative-analytics.read trapi.messenger trapi.sdbold trapi.search.lookup.read trapi.search.metadata.read trapi.search.read trapi.user-framework.mobile.crud trapi.user-framework.recently-used.crud trapi.user-framework.workspace.crud",

"token_type":"Bearer"

}

Sending EDP-GW service discovery request to https://api.refinitiv.com/streaming/pricing/v1/

('EDP-GW service discovery HTTP code:', 403, 'Forbidden')

Stop trying with the request

Failed to retrieve endpoints from EDP Service Discovery. Exiting...

Upvote
9.5k 10 5 7

Hello Sundeep

According to the error 403, 'Forbidden', it is possible that you may not have permission to access https://api.refinitiv.com/streaming/pricing/v1/

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

Thanks Pimchaya

I tried the other one (https://api.refinitiv.com/streaming/pricing/beta1/) and getting this error. This is even though I am using region = 'apac'

Sending EDP-GW service discovery request to https://api.refinitiv.com/streaming/pricing/beta1/

EDP-GW Service discovery succeeded. RECEIVED:

{

"service":[

{

"dataFormat":[

"tr_json2"

],

"endpoint":"amer-3.pricing.streaming.edp.thomsonreuters.com",

"location":[

"us-east-1a",

"us-east-1b"

],

"port":443,

"provider":"aws",

"transport":"websocket"

},

{

"dataFormat":[

"tr_json2"

],

"endpoint":"amer-2.pricing.streaming.edp.thomsonreuters.com",

"location":[

"us-east-1b"

],

"port":443,

"provider":"aws",

"transport":"websocket"

},

{

"dataFormat":[

"tr_json2"

],

"endpoint":"amer-1.pricing.streaming.edp.thomsonreuters.com",

"location":[

"us-east-1a"

],

"port":443,

"provider":"aws",

"transport":"websocket"

}

]

}

Traceback (most recent call last):

File "market_price_edpgw_service_discovery.py", line 400, in <module>

if not query_service_discovery():

File "market_price_edpgw_service_discovery.py", line 203, in query_service_discovery

for index in range(len(response_json['services'])):

KeyError: 'services'

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.

Hello @Sundeep.Tariyal

Please post your new questions as a separate question. When the answer of this post is accepted, marked as "correct", the community tends to only look at the accepted answer and may miss your new questions on the same topic. Posting the new questions on a separate page allows everyone can see the questions and can post answers to help you.

Upvotes
45.2k 103 44 60

@Sundeep.Tariyal

https://api.refinitiv.com/streaming/pricing/v1/ uses "services" as a key.


{
  "services": [
    {
      "port": 14002,
      "location": [
        "eu-west-1b"

On the other hand, https://api.refinitiv.com/streaming/pricing/beta1/ uses "service" as a key.

{
  "service": [
    {
      "port": 14002,
      "location": [
        "us-east-1a",
        "us-east-1b"
      ],

You need to use https://api.refinitiv.com/streaming/pricing/v1/ instead of https://api.refinitiv.com/streaming/pricing/beta1/.

Otherwise, you need to modify the code to use "service" instead.

File "market_price_edpgw_service_discovery.py", line 203, in query_service_discovery

for index in range(len(response_json['services'])):


If you have any further questions, feel free to submit a new question in the forum.

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.