Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ofxclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# python 2
from urllib import splittype, splithost
import uuid
import ssl

DEFAULT_APP_ID = 'QWIN'
DEFAULT_APP_VERSION = '2500'
Expand Down Expand Up @@ -154,7 +155,15 @@ def _do_post(self, query, extra_headers=[]):
logging.debug('posting data to %s' % i.url)
garbage, path = splittype(i.url)
host, selector = splithost(path)
h = HTTPSConnection(host, timeout=60)
try:
h = HTTPSConnection(host, timeout=60)
h.connect()
except ssl.SSLError as ex:
if (ex.reason == "UNSUPPORTED_PROTOCOL"):
h = HTTPSConnection(host, timeout=60, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))
h.connect()
else:
raise
# Discover requires a particular ordering of headers, so send the
# request step by step.
h.putrequest('POST', selector, skip_host=True,
Expand Down