Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 16:42:05 +0000



Post From: Sierra Chart API Error

[2024-05-17 17:22:23]
User719512 - Posts: 263
To add on here, there are API errors from Python as well where requests does not work, but urllib3 does. requests gives SSL errors unless you turn off verify (strongly discouraged of course!).

NOTE: looks like your form/site is trying to make the "CODE" with a Sierra URL into a link.


previously worked now broken:


with requests.Session() as session:
for sierra_dll in sierra_dlls:

if True:
url = 'https://www.sierrachart.com/API.php'
payload = {
'AdminUsername': username,
'AdminPassword': password,
'Service': 'CustomDLLStudiesManagement',
'SCDLLName': sierra_dll,
'Action': 'GetAllUsersForDll'
}

# Use the post method to send a POST request
!!!broken
response = session.post(url, data=payload)
!!!workaround
response = session.post(url, data=payload, verify=False)


this code works and must use some different cert chain verification:


http = urllib3.PoolManager()
resp = http.request(
'POST',
'https://www.sierrachart.com/API.php',
fields={
'AdminUsername' : username,
'AdminPassword' : password,
'Service' : 'CustomDLLStudiesManagement',
'SCDLLName' : sierra_dll,
'Action' : 'GetAllUsersForDll',
}
)

json_data = json.loads(resp.data)