question

Upvotes
Accepted
22 3 4 10

Could not get any response - Postman

I am trying the Tuto1a for user authentication under the postman tutorials collection. When I try to send I am getting the following error

Checking on the postman log the following error is found

[24720][1553500971614][requester][info]["ACService~can: No permission found for",{"model":"workspace","modelId":"29ba1c6f-43ab-4e23-8a6c-27c39a57a069","action":"CREATE_HISTORY"}] [24720][1553500996975][requester][info]["ACService~can: No permission found for",{"model":"workspace","modelId":"29ba1c6f-43ab-4e23-8a6c-27c39a57a069","action":"CREATE_HISTORY"}]

Can you please assist?

tick-history-rest-apipostman
postman.png (19.7 KiB)
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
Accepted
13.7k 27 8 12

@KAKIT.LAI,

In a nutshell (for a simple proxy without authentication):

response = requests.post(urlGetToken, tokenRequestBody, headers = header1, proxies={"https":"proxy.mydomain.com"})

For more info, see for instance this stackoverflow query, or better yet, in the requests documentation.

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
25.1k 68 15 21

@KAKIT.LAI From the screenshot it looks like the Postman REST environment has not been imported, or not been selected.

Please import - TRTH REST.postman_environment.json file and select/apply it before invoking the call. You will also have to modify the dss-user and dss-password environment variables to your userID, before invoking the authorization call.

Let me know if it still doesn't work and we can try to walk you through this.

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
22 3 4 10

It still doesn't work. Can you walk me through this? Thanks.

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
25.1k 68 15 21

@KAKIT.LAI Can you please try the instructions at - https://developers.refinitiv.com/thomson-reuters-tick-history-trth/thomson-reuters-tick-history-trth-rest-api/learning?content=8712&type=learning_material_item

It you are still having difficulty, I can post screenshots of the process.

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
22 3 4 10

Hi Gurpeet, it still doesnt work and the following error is seen under the postman log.

[20832][1553566585517][requester][info]["ACService~can: No permission found for",{"model":"workspace","modelId":"29ba1c6f-43ab-4e23-8a6c-27c39a57a069","action":"CREATE_HISTORY"}] [20832][1553566616132][requester][info]["ACService~can: No permission found for",{"model":"workspace","modelId":"29ba1c6f-43ab-4e23-8a6c-27c39a57a069","action":"CREATE_HISTORY"}]

We have proxy setup here and I have already define it under the setting. Having check with the network team they saw connection went out from the proxy but there is an error "SSL client handshake completion failure" observed from the proxy log. Any idea?


capture.png (17.5 KiB)
capture.png (46.7 KiB)
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
22 3 4 10

I manage to get it working now. Thanks.

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
25.1k 68 15 21

Glad that it is working for you now. As you have identified, the parameters DSS username and password have to be entered in the Postman environment and not in the OS environment.

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
22 3 4 10

I am having issue retrieve the token with the following error. I suspect its because the proxy is not set.

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='hosted.datascopeapi.reuters.com', port=443): Max retries exceeded with url: /RestApi/v1/Authentication/RequestToken (Caused by NewConnection Error('<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000037687F0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))

The following is the python code I used. Can you advise how to pass in the proxy info to the query?

import requests, json from requests import Request, Session from collections import OrderedDict urlGetToken = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken' header1 = {'Content-Type': 'application/json'} tokenRequestBody = json.dumps({'Credentials': {'Password': 'xxxxxxx', 'Username': 'xxxxxxx'}}) response = requests.post(urlGetToken, tokenRequestBody, headers = header1) statusCode = response.status_code if statusCode != 200: print('ERROR: Get Token failed with HTTP status code: ' + str(statusCode)) sys.exit(-1) else: result = response.json() token = result['value'] print(token)
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
25.1k 68 15 21

@KAKIT.LAI, In addition to passing proxy information in the code as shown by Christiaan, Python "requests" can also be instructed to use proxy by enabling following command line environment variables:

set https_proxy=http://proxy:port
set http_proxy=http://proxy:port
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
22 3 4 10

Thanks Christiaan and Gurpreet. It works but now I am getting the certificate error below. Any idea?

Traceback (most recent call last): File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 444, in wrap_socket cnx.do_handshake() File "C:\Anaconda3\envs\py36\lib\site-packages\OpenSSL\SSL.py", line 1907, in do_handshake self._raise_ssl_error(self._ssl, result) File "C:\Anaconda3\envs\py36\lib\site-packages\OpenSSL\SSL.py", line 1639, in _raise_ssl_error _raise_current_error() File "C:\Anaconda3\envs\py36\lib\site-packages\OpenSSL\_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\connectionpool.py", line 594, in urlopen self._prepare_proxy(conn) File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\connectionpool.py", line 815, in _prepare_proxy conn.connect() File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\connection.py", line 356, in connect ssl_context=context) File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\util\ssl_.py", line 359, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\contrib\pyopenssl.py", line 450, in wrap_socket raise ssl.SSLError('bad handshake: %r' % e) ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Anaconda3\envs\py36\lib\site-packages\requests\adapters.py", line 449, in send timeout=timeout File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Anaconda3\envs\py36\lib\site-packages\urllib3\util\retry.py", line 398, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='hosted.datascopeapi.reuters.com', port=443): Max retries exceeded with url: /RestApi/v1/Authentication/RequestToken (Caused by SSLError(SSLE rror("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "REST.py", line 8, in <module> response = requests.post(urlGetToken, tokenRequestBody, headers = header1, proxies=proxies) File "C:\Anaconda3\envs\py36\lib\site-packages\requests\api.py", line 116, in post return request('post', url, data=data, json=json, **kwargs) File "C:\Anaconda3\envs\py36\lib\site-packages\requests\api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "C:\Anaconda3\envs\py36\lib\site-packages\requests\sessions.py", line 533, in request resp = self.send(prep, **send_kwargs) File "C:\Anaconda3\envs\py36\lib\site-packages\requests\sessions.py", line 646, in send r = adapter.send(request, **kwargs) File "C:\Anaconda3\envs\py36\lib\site-packages\requests\adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='hosted.datascopeapi.reuters.com', port=443): Max retries exceeded with url: /RestApi/v1/Authentication/RequestToken (Caused by SSLError(SSLError ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

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
13.7k 27 8 12

@KAKIT.LAI,

You need to configure your code to support the DigiCert CA (both root and intermediate) which is used to sign all Refinitiv domains.

In a nutshell:

  1. Download DigiCert root and intermediate certificates here.
  2. Create a PEM file out of both certificates.
  3. Use it in your requests:
response = requests.post(urlGetToken, tokenRequestBody, headers = header1, proxies={"https":"proxy.mydomain.com"}, verify = 'digicert.pem')

As a test you could also disable verification, but that would make your application vulnerable to man in the middle attacks, so this is not recommended:

response = requests.post(urlGetToken, tokenRequestBody, headers = header1, proxies={"https":"proxy.mydomain.com"}, verify = false)

For detailed instructions, see this post in stackoverflow, as well as this one.

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
22 3 4 10

Thanks Christiaan. I downloaded both DigiCertHighAssuranceEVRootCA.crt and DigiCertHighAssuranceEVCA-1.crt. How can i create a PEM file out of both certificates? I try to cat DigiCertHighAssuranceEVCA-1.crt >> DigiCertHighAssuranceEVRootCA.crt and run the following but didnt work..

openssl x509 -in DigiCertHighAssuranceEVRootCA-new.crt -inform DER -out DigiCert.pem -outform PEM

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.

@KAKIT.LAI,,

Can you try this (taken from this post in stackoverflow):

  • Cat both files together into a new file chain.pem. Make sure that each of the files did end with a valid end of line character (which they do not as downloaded). The resulting file should look like this.

Caveat: I'm not an expert on this, I have never done this myself as I never ran into this issue. I was hoping those 2 links would help, but maybe there is more to it.

Upvotes
22 3 4 10

Thanks Christiaan. You can close this ticket. I will raise a separate ticket if i have another question.

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.