Error: Max retries exceeded with url: /RestApi/v1/Authentication/RequestToken

I am getting the below error while trying to get token from DSS REST API, Even after using verify = False , I am getting the same error

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='hosted.datascopeapi.reuters.com', port=443): Max retries exceeded with url: /RestApi/v1/Authentication/RequestToken (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f29d510f820>: Failed to establish a new connection: [Errno -2] Name or service not known'))


Code Used:

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': '*****', 'Username': '*******'}})
response = requests.post(urlGetToken, tokenRequestBody, headers = header1, verify=False)
statusCode = response.status_code
if statusCode != 200:
print('ERROR: Get Token failed with HTTP status code: ' + str(statusCode))

else:
result = response.json()
token = result['value']
print(token)

Best Answer

  • Hello @prakash.balusamy,

    Looks like you are not reaching DSS endpoint.

    Usually, this happens when one is running from behind a firewall and requires to use a proxy to connect.

    You may find this discussion to be relevant.

    You may be using proxy settings in other applications connecting to external destinations from the same machine, allowing you to reuse the same settings. Or may need to find out the appropriate proxy settings from your organization's network admin/group.

    Let us know how this suggestion works for you, if you are able to make progress.

Answers