Error in proxy connection in DSWS API

Proxy connection DSWS.pngOne of our clients wants to connect through proxy when using DSWS API. His code currenlty looks like the attached, but getting following error msg:
HTTPSConnectionPool(host='product.datastream.com', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetToken (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
_get_json_Response : Exception Occured:
HTTPSConnectionPool(host='product.datastream.com', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetToken (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
get_data : Exception Occured
(<class 'Exception'>, Exception('Invalid Token Value'), <traceback object at 0x0000029FA02A7788>)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\DatastreamDSWS\DS_Response.py", line 146, in get_data
raise Exception("Invalid Token Value")
Please assist. Thank you.
Best Answer
-
On Windows, the Datastream Python library uses the wincertstore package to load the Windows certificate file.
The code looks like this:
import requests
import wincertstore
cfile = wincertstore.CertFile()
cfile.addstore('CA')
cfile.addstore('ROOT')
cfile.addstore('MY')
proxy="http://<proxy>:<port>"
url = 'https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/GetToken';
myobj = {"Password": "<password>",
"Properties": [{"Key": "__AppId", "Value": "PythonLib-1.1.0"}],
"UserName": "<username>"}
x = requests.post(url, json = myobj, proxies={'http':proxy, 'https':proxy}, verify=cfile.name)
print(x.status_code)
print(x.text)0
Answers
-
I can run the DSWS API through the proxy properly.
The problem may be specific to the client's environment. The client can contact the client's IT support team to verify the proxy settings.
0 -
Thanks very much @Jirapongse Jirapongse. Would you by the way have any examples frequently experienced in regards to client's IT related issues in similar cases? That'd be greatly helpful. Thanks again.
0 -
The datastream server is on the Internet so any machines that can connect to the Internet can access the server.
Therefore, if clients are unable to connect to the datastream server, it could be a problem in network, proxy, or firewall settings.0 -
Would you have any other suggestions for the client to look into?
Cheers,
Bob
0 -
The client can try the following code.
import requests
#http_Response = requests.post(reqUrl, json=jsonRequest, proxies=self._proxy, verify=self._sslCer, timeout= self._timeout)
proxy="<proxy server>"
url = 'https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/GetToken';
myobj = {"Password": "<password>",
"Properties": [{"Key": "__AppId", "Value": "PythonLib-1.1.0"}],
"UserName": "<username>"}
x = requests.post(url, json = myobj, proxies={'http':proxy, 'https':proxy})
print(x.status_code)
print(x.text)The client may need to specify the certificate file in the sslCer parameter.
Datastream(username, password, config=None, dataSource=None, proxy=None, sslCer=None)
What operating system (Windows or Linux) is the client using?
0 -
But can client directly use the above code, i.e. I'm guessing he will just need to replcace <proxy server>, <username> and <password>, but able to use the rest?
Lastly do you also directly support end users/clients via email?
Thanks again!
0 -
Correct. The client needs to change proxy server>, <username> and <password>.
To get direct support, the client needs to submit an issue to MyRefinitiv.
0 -
Hi Jira,
Thanks again for that. The client however came back with follow up question and information. Can you add your input one last time considering what the user mentioned below?
1. Client says the proxy issue only shows when he's in the office, and okay when working from home. But again, okay when using the proxy for his DSS API at work.
2. Client is using Windows, but now sure where the certificates are located. Would you be able to advise where it may be located?
Thanks again Jira!
Best,
Bob
0 -
Cheers,
Bob
0 -
Yes, Datastream uses this requests.post method to send requests to the Datastream server.
0 -
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 613 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 248 ETA
- 552 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 630 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 86 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛