Cannot conned to DSWS via python

Ran the code below to try and ID the issue per the recommendations posted:

import DatastreamDSWS as DSWS 
import requests 
import json 
import os 
 
url = "https://product.datastream.com/DSWSClient/V1/DSService.svc/rest/
token_url = url + "GetToken" 
 
def json_Request( raw_text): 
    jsonText = json.dumps(raw_text) 
    byteTemp = bytes(jsonText,'utf-8') 
    byteTemp = jsonText.encode('utf-8') 
    jsonRequest = json.loads(byteTemp) 
    return jsonRequest 
 
os.environ['HTTP_PROXY']="http://127.0.0.1:8080
os.environ['HTTPS_PROXY']="http://127.0.0.1:8080
tokenReq = {"Password":'<password>',"Properties":[{'Key':'__AppId','Value':"PythonLib 1.0"}],"UserName":'<username>'} 
json_tokenReq = json_Request(tokenReq) 
 
json_ResponseRaw = requests.post(token_url, json=json_tokenReq) 
print(json_ResponseRaw.status_code, json_ResponseRaw.text) 
 
json_Response = json_ResponseRaw.json() 
print(json_Response["TokenValue"])

and got back:

ProxyError: HTTPSConnectionPool(host='product.datastream.com', port=443): Max retries exceeded with url: /DSWSClient/V1/DSService.svc/rest/GetToken (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001C898EDBAC8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')))

Best Answer