How to run django runerver over TLS 1.2

I am testing Stripe orders on my local Mac OS X machine. I am implementing this code:

stripe.api_key = settings.STRIPE_SECRET

        order = stripe.Order.create(
          currency = 'usd',
          email = 'j@awesomecom',
          items = [
                    {
                      "type":'sku',
                      "parent":'sku_88F260aQ',
                      "quantity": 1,
                    }
                  ],
          shipping = {
            "name":'Jenny Rosen',
            "address":{
              "line1":'1234 Main Street',
              "city":'Anytown',
              "country":'US',
              "postal_code":'123456'
            }
          },
        )

I get an error message:

Stripe no longer supports API requests made using TLS 1.0. please initiate HTTPS connections with TLS 1.2 or later.

I am using django 1.10 and python version 2.7.10

How can I force TLS 1.2? Would I do it on the python or django side?

+4
source share
3 answers

I decided to install these libraries:

pip install urllib3
pip install pyopenssl
pip install ndg-httpsclient
pip install pyasn1

of:

https://github.com/pinax/pinax-stripe/issues/267

+6
source

This is not a django problem, but a problem with the operating system and language.

Mac OS X brew python. env, python open ssl.

:

XCode, OpenSSL. python brew. virtualenv.

+1

If you have already tried updating openssl and python (using brew) and still do not work, make sure your settings have DEBUG = False.

See this topic for more information https://code.google.com/p/googleappengine/issues/detail?id=13207

0
source

Source: https://habr.com/ru/post/1653358/


All Articles