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)