Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TLSv1 in some way #48

Open
egh opened this issue Sep 4, 2017 · 0 comments
Open

Support TLSv1 in some way #48

egh opened this issue Sep 4, 2017 · 0 comments

Comments

@egh
Copy link

egh commented Sep 4, 2017

On python 2.7.13 (debian), TLS v1 is not supported by default. This is reasonable, but the Patelco credit union (and possibly other banks) does not support any later version.

Is it possible to extend ofxclient in some way to support TLSv1? Perhaps by supporting a per-institution configuration?

I was able to patch in support using the following, but there is probably a better way:

index dc2cbf9..c7daf36 100644
--- a/ofxclient/client.py
+++ b/ofxclient/client.py
@@ -15,6 +15,7 @@ except ImportError:
     # python 2
     from urllib import splittype, splithost
 import uuid
+import ssl
 
 DEFAULT_APP_ID = 'QWIN'
 DEFAULT_APP_VERSION = '2500'
@@ -132,7 +133,10 @@ class Client:
         logging.debug(query)
         garbage, path = splittype(i.url)
         host, selector = splithost(path)
-        h = HTTPSConnection(host, timeout=60)
+        if host == 'ofx.patelco.org':
+            h = HTTPSConnection(host, timeout=60, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1))
+        else:
+            h = HTTPSConnection(host, timeout=60)
         # Discover requires a particular ordering of headers, so send the
         # request step by step.
         h.putrequest('POST', selector, skip_host=True,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant