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

SSLError (just started, this was working yesterday) #80

Closed
teewuane opened this issue Dec 14, 2016 · 6 comments
Closed

SSLError (just started, this was working yesterday) #80

teewuane opened this issue Dec 14, 2016 · 6 comments

Comments

@teewuane
Copy link

Here is a traceback, I use braintree in my django app.

Internal Server Error: /my-django-url/
Traceback (most recent call last):
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner
response = get_response(request)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/myuser/Projects/my_env/my_project/my_app/views.py", line 56, in my_function
bt_authorization = braintree.ClientToken.generate()
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/braintree/client_token.py", line 16, in generate
return gateway.generate(params)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/braintree/client_token_gateway.py", line 24, in generate
response = self.config.http().post(self.config.base_merchant_path() + "/client_token", params)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/braintree/util/http.py", line 52, in post
return self.__http_do("POST", path, params)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/braintree/util/http.py", line 70, in __http_do
status, response_body = http_strategy.http_do(http_verb, full_path, self.__headers(), request_body)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/braintree/util/http.py", line 91, in http_do
timeout=self.config.timeout
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/requests/api.py", line 110, in post
return request('post', url, data=data, json=json, **kwargs)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/Users/myuser/Projects/my_env/lib/python2.7/site-packages/requests/adapters.py", line 497, in send
raise SSLError(e, request=request)
SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)

So, I'm not sure if this is a requests issue or how braintree is using requests. Pretty odd though!

@teewuane
Copy link
Author

Oops, just read the "PLEASE NOTE" on the README about requiring TLSV1.2. I'll try and figure this out.

@teewuane
Copy link
Author

Found some guidance here: https://github.com/paypal/tls-update#python

@teewuane
Copy link
Author

Hmm. I'm still not able to get this working. I am on Mac OS Sierra. It is up to date.

This is what I have installed in my virtualenv.

braintree (3.32.0)
Django (1.10.4)
pip (9.0.1)
psycopg2 (2.6.2)
requests (2.12.4)
setuptools (30.0.0)
wheel (0.29.0)

Using python2.7

@danakatz
Copy link

Hi @teewuane ! You're right, this sounds like it's related to the TLS 1.2 requirement. I'd recommend reaching out to Braintree support for help with the specifics of your integration.

@Tyrdall
Copy link

Tyrdall commented Jan 11, 2017

I've updated the braintree (3.33.0) and requests (2.12.4) packages and now it works again.

@pebreo
Copy link

pebreo commented Jun 5, 2017

I had to reinstall XCode and update brew and pyenv. Here are the commands I used:

#Update XCode 
#Restart machine
$ brew update
$ brew upgrade pyenv
$ pyenv install 3.4.6 # newest 3.4.x of Python
$ pyenv global 3.4.6 # set as default version of python
$ pyenv virtualenv 3.4.6 myenv
$ pyenv activate myenv
$ pip install -r requirements.txt

Hope that's useful to someone someday.

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

4 participants