2

I'm attempting to access the FINRA ATS API using Python (3.7.1) and the Requests package behind a corporate firewall, but I keep receiving the 'SSLError: HTTPSConnectionPool' error listed below. I have also tried Solution #1 and 'os.environ["PYTHONHTTPSVERIFY"] = "0" to no avail, but I was able to execute a CURL script and successfully pull data from the API after adding -k --insecure inputs. Does anyone know of a way to completely ignore/disable verifying the SSL certificate or another workaround?

Code

import requests

headers = {'Content-Type': 'application/json','Accept': 'application/json',}

data = '{ "compareFilters": [ { "compareType": "EQUAL", "fieldName": "lastUpdateDate","fieldValue": "2019-01-22" },{ \"compareType\": \"EQUAL\", \"fieldName\": \"tierDescription\",\"fieldValue\": \"NMS Tier 1\" }] ,"limit":99999999 }'

response = requests.post('https://api.finra.org/data/group/otcMarket/name/weeklySummary', headers=headers, data=data)

data = response.json()

SSLError

SSLError: HTTPSConnectionPool(host='api.finra.org', port=443): Max retries exceeded with url: /data/group/otcMarket/name/weeklySummary (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl_choose_client_version', 'inappropriate fallback')])")))

Solution #1 (Attempted and Failed)

How do I disable the security certificate check in Python requests

Colt
  • 21
  • 3

0 Answers0