Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Refinitiv Data Platform /
avatar image
Question by jaroslaw.szymanski · Jan 19 at 01:55 PM · api python

Refinitiv Data Platform API connection error

Hello,
I am trying to establish python api connection to refinitiv dataplatform.

I have already installed refinitiv-dataplatform library for python (https://pypi.org/project/refinitiv-dataplatform/).

I am trying to establish connection throught following command:
rdp.open_platform_session( 'token', rdp.GrantPassword( 'user', 'password' ) )

Unfortunately, I gets following error in response: "2021-01-19 13:50:01,725 - Session session.platform - Thread 44920 | MainThread [Error -1 - ConnectError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'".

Could i kindly ask you to help me understand and solve this problem?


135838.png (44.4 KiB)

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

7 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Gurpreet · Jan 25 at 06:53 PM

Further update: I was able to get similar error when the library is used in conjunction with a proxy server which intercepts and re-sign's the https requests.

rdp.open_platform_session(appKey, rdp.GrantPassword(username = myuser, password = mypass))

2021-01-25 13:48:34,624 - Session session.platform - Thread 9916 | MainThread [Error -1 - SSLCertVerificationError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get localissuer certificate (_ssl.c:1124)'

<refinitiv.dataplatform.core.session.platform_session.PlatformSession object at 0x00000000025A2760>


To alleviate this issue:

  • Are you able to connect without going through proxy server?
  • If not, do you have access to proxy's certificate?

Also, what is the result after you installed:

python-certifi-win32
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by nick.zincone.1 · Jan 19 at 04:09 PM

Hi @jaroslaw.szymanski,

This may be related to your environment. Can you please provide the following:

  • version of the refinitiv-dataplatform
  • version of the http dependencies: httpcore, httpx, requests
  • version of your desktop Eikon/Refinitiv Workspace
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by jaroslaw.szymanski · Jan 19 at 05:18 PM

Thank you for your interest and additional questions.
Here are the versions of the relevant software:
refinitiv-dataplatform==1.0.0a7.post1
httpcore==0.10.2
httpx==0.14.3
requests==2.24.0
Eikon desktop 4.0.52 (4.0.52055)

Moreover, I forgot to mention this ealier, but I managed to establish connection via python API using following command:

rdp.open_desktop_session('token')

But as far as I know, this metod requires locally installed and actively running eikon software. That is why, I am looking for this second method of connection to be working.

Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
nick.zincone.1 ♦♦ · Jan 19 at 05:57 PM 0
Share

Thanks @jaroslaw.szymanski,

I matched your dependencies and did not see the same behavior. It's good you tested your desktop and that you are able to establish a connection. Because, you are connecting directly into the platform (not through the desktop), this will have no dependencies.

I'm in contact with the developer and will keep you updated.

thanks.

avatar image
REFINITIV
Answer by nick.zincone.1 · Jan 19 at 06:45 PM

Hi @jaroslaw.szymanski,

We would like to capture some debugging information from you if that is ok. At the top of your code, can you insert this:

# to get trace from http lib
import os
os.environ['HTTPX_LOG_LEVEL']='trace'
os.environ['HTTPCORE_LOG_LEVEL']='trace'

This will generate output to the console. In addition, you should also see a log file created in your current directory. If you can also include the details from your log, stripping out any login credentials, if necessary.

thanks.

Comment
wasin.waeosri

People who like this

1 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by jaroslaw.szymanski · Jan 20 at 10:09 AM

Above debugging code generated folowing output in my console:

TRACE [2021-01-20 11:01:21] httpx._config - load_ssl_context verify=True cert=None trust_env=True http2=False

TRACE [2021-01-20 11:01:21] httpx._config - load_verify_locations cafile=h:\python\lib\site-packages\certifi\cacert.pem

TRACE [2021-01-20 11:01:22] httpcore._async.connection_pool - get_connection_from_pool=(b'https', b'api.refinitiv.com', 443)

TRACE [2021-01-20 11:01:22] httpcore._async.connection_pool - created connection=<AsyncHTTPConnection http_version=UNKNOWN state=0>

TRACE [2021-01-20 11:01:22] httpcore._async.connection_pool - adding connection to pool=<AsyncHTTPConnection http_version=UNKNOWN state=0>

TRACE [2021-01-20 11:01:22] httpcore._async.connection - open_socket origin=(b'https', b'api.refinitiv.com', 443) timeout={'connect': 60, 'read': 60, 'write': 60, 'pool': 60}

TRACE [2021-01-20 11:01:22] httpcore._async.connection_pool - remove from pool connection=<AsyncHTTPConnection http_version=UNKNOWN state=5>

TRACE [2021-01-20 11:01:22] httpcore._async.connection_pool - removing connection from pool=<AsyncHTTPConnection http_version=UNKNOWN state=5>

2021-01-20 11:01:22,764 - Session session.platform - Thread 39868 | MainThread

[Error -1 - ConnectError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'

<refinitiv.dataplatform.core.session.platform_session.PlatformSession at 0x209d4e96520>

And this is the content of log file:

[2021-01-20 10:57:47,220] - [session.platform] - [ERROR] - [access_token_updater] - [_do_update] - [Error -1 - ConnectError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'
Comment

People who like this

0 Show 4 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
nick.zincone.1 ♦♦ · Jan 20 at 02:59 PM 0
Share

Hi @jaroslaw.szymanski,

Thank you for the details - I will pass this off to the development team. One thing I forgot to ask, is what version of Python are you using?

thanks

avatar image
jaroslaw.szymanski nick.zincone.1 ♦♦ · Jan 20 at 03:06 PM 0
Share

I am using Python 3.8.5.

avatar image
REFINITIV
nick.zincone.1 ♦♦ jaroslaw.szymanski · Jan 20 at 03:32 PM 0
Share

Hi @jaroslaw.szymanski,

Thank you. We're going through the list of dependencies as we believe there may be a conflict within. Can you provide the version of your 'nest-asyncio'? We are using version 1.3.3.

avatar image
REFINITIV
Answer by nick.zincone.1 · Jan 25 at 04:56 PM

Hi @jaroslaw.szymanski,

I'm working with development to better understand your situation. Given you are having no issues when you use the desktop session

rdp.open_desktop_session('token')

Is a good indication the http packages you have are not the issue. I tried to replicate your environment, making sure I'm using the same version of Python, and did not run into any issues.

While development believes the Python code, by default, doesn't take into account Windows certificates, they want you to try the following:

> pip install python-certifi-win32

This is based on the assumption that if you are using Windows and you have already imported the CA in the trusted DB store, you can install the package python-certifi-win32 that automagically will use the same certificates from the Trusted DB store.

https://pypi.org/project/python-certifi-win32/

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Gurpreet · Jan 25 at 06:14 PM

Hi @jaroslaw.szymanski,

Can you please confirm if you are going through a proxy server?

Comment

People who like this

0 Show 4 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
jaroslaw.szymanski · Jan 27 at 10:30 AM 0
Share

I can only confirm, that I am using VPN connection.

avatar image
REFINITIV
Gurpreet ♦♦ jaroslaw.szymanski · Jan 27 at 01:36 PM 0
Share

What is the result after updating the python certificates - python-certifi-win32.

If all else fails, you might need to create a new python virtual environment and do a clean install of refinitiv-dataplatform library.

avatar image
jaroslaw.szymanski Gurpreet ♦♦ · Jan 27 at 02:15 PM 0
Share

I think, that installing python-certifi-win32 nothing changed.

[2021-01-27 11:27:19,804] - [session.platform] - [ERROR] - [access_token_updater] - [_do_update] - [Error -1 - ConnectError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'

2021-01-27 11:27:19,804 - Session session.platform - Thread 38816 | MainThread [Error -1 - ConnectError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)' 2021-01-27 11:27:19,804 - Session session.platform - Thread 38816 | MainThread [Error -1 - ConnectError] b'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
10 People are following this question.
  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges