Mak
Mak

Reputation: 31

Can't call Stripe on Appengine development server even with latest ssl

I am running into the same issue on my development server. I have already checked out stackoverflow.com/questions/46799365/… and that hasn't worked for me.

python -V
Python 2.7.11

and as soon as I call stripe, I get the Support for test mode requests made with versions of TLS lower than 1.2 has been disabled, and support in live mode will be dropped on June 13, 2018. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.

My app.yaml has ssl set to "latest" libraries: - name: django version: "1.9" - name: jinja2 version: "2.6" - name: markupsafe version: "0.15" - name: ssl version: latest - name: pycrypto version: latest

So am I supposed to do something with sandbox.py? I think my request is version 2.16.0 because I was getting some other environment issue when it wasn't. Is that he culprit or something else?

Here's the exact error

PermissionError at /
Request req_DrUOViv9FnjhAx: Support for test mode requests made with versions 
of TLS lower than 1.2 has been disabled, and support in live mode will be dropped on June 13, 2018. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.
Request Method:
GET
Request URL:
http://localhost:8080/
Django Version:
1.9.5
Exception Type:
PermissionError
Exception Value:
Request req_DrUOViv9FnjhAx: Support for test mode requests made with versions of TLS lower than 1.2 has been disabled, and support in live mode will be dropped on June 13, 2018. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.
Exception Location:
lib/stripe/api_requestor.py in handle_error_response, line 178
Python Executable:
/Users/USERNAME/PycharmProjects/PROJECTNAME/virtualenv-dev/bin/python
Python Version:
2.7.11
Python Path:
['/Users/USERNAME/PycharmProjects/PROJECTNAME',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine',
 '/Users/USERNAME/PycharmProjects/PROJECTNAME',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine',
 '/Users/USERNAME/PycharmProjects/PROJECTNAME/virtualenv/lib/python2.7',
 '/Users/USERNAME/PycharmProjects/PROJECTNAME/virtualenv/lib/python2.7/lib-dynload',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/django-1.9',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/jinja2-2.6',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/markupsafe-0.15',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/ssl-2.7.11',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/pycrypto-2.6',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/setuptools-0.6c11',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/pytz-2017.2',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.3',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/webob-1.1.1',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/werkzeug-0.11.10',
 '/Users/USERNAME/Downloads/google-cloud-sdk/platform/google_appengine/lib/yaml-3.10',
 'lib']
Server time:
Sat, 24 Mar 2018 00:43:28 -0500

Upvotes: 3

Views: 240

Answers (3)

Mak
Mak

Reputation: 31

Hope this helps someone in this situation....I had my IT admin help me and and it was a combination of things so I'm posting the solution here for my case to save someone else from the same frustration.

These instructions assume you are running these commands all as an Administrator

First remove HomeBrew:

echo -ne 'y\n' | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" sudo rm -rf /usr/local/Homebrew sudo rm -rf /usr/local/Caskroom sudo rm -rf /usr/local/Cellar

Remove other Pythons installed (v2)

sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7 sudo rm -rf "/Applications/Python 2.7"

Check for links and remove any you find with Cellar in the path

ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | grep 'Cellar' unlink <## Remove those you found ##>

Re-install Homebrew

echo -ne 'y\n' | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Add in openssl

brew install openssl brew postinstall openssl brew link openssl --force

Force Link openssl if needed

ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Add in Python

brew install python@2 brew postinstall python@2 brew link python@2 --force

link openssl and Python (ensure these versions are what you have installed)

ln -s /usr/local/Cellar/openssl/1.0.2o/bin/openssl /usr/local/bin/openssl ln -s /usr/local/Cellar/openssl/1.0.2o/bin/openssl /usr/local/ssl/bin/openssl ln -s /usr/local/Cellar/python/2.7.14/bin/python /usr/local/bin/python

Clean HomeBrew Once Installed

brew cleanup -s brew cask cleanup brew prune

From here the command showed the correct version

python -c 'import ssl; print ssl.OPENSSL_VERSION'

Upvotes: 0

minou
minou

Reputation: 16563

I spent many hours on this about a month ago. It was a huge pain, but I finally got it to work.

One issue I was having is that Brew does something very annoying with its python versions. It makes python v3 the default so if you type python in the shell you get v3 and not v2. I manually changed the relevant symlinks in '/usr/local/bin' to make v2 the default.

I don't remember all the steps I took, but you'll want your '/usr/local/bin' to look something like this:

openssl -> /usr/local/Cellar/openssl/1.0.2n/bin/openssl
pip -> ../Cellar/python/2.7.14_3/bin/pip2
python -> ../Cellar/python/2.7.14_3/bin/python2

You'll then want to delete your virtualenv's and recreate them.

Note that I don't use python v3 at all, so if you need both v2 and v3 then YMMV.

Upvotes: 1

Dan Cornilescu
Dan Cornilescu

Reputation: 39824

In addition to using the latest GAE ssl library, when running the application on the local development server you may also need to upgrade your local system's openssl library.

From How do I upgrade my Stripe integration from TLS 1.0 to TLS 1.2? (other specific OS versions are mentioned separately):

And from How do I upgrade my OpenSSL to support TLS 1.2? (other specific OS versions are mentioned separately):

If you are using any other Linux variant, you will need to ensure that running openssl version gives a version of at least 1.0.1. If it does not, you will need to take package updates, and may need to upgrade to a newer version of your operating system.

Upvotes: 0

Related Questions