如何在TLS 1.2上运行django runserver

Atm*_*tma 4 python django ssl python-2.7 tls1.2

我正在我的本地Mac OS X机器上测试Stripe订单.我正在实现此代码:

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'
            }
          },
        )
Run Code Online (Sandbox Code Playgroud)

我收到一个错误:

Stripe不再支持使用TLS 1.0进行的API请求.请使用TLS 1.2或更高版本启动HTTPS连接.

我使用的是django 1.10和python版本2.7.10

如何强制使用TLS 1.2?我会在python或django方面这样做吗?

Gab*_*abo 6

我解决了安装这个库:

pip install urllib3
pip install pyopenssl
pip install ndg-httpsclient
pip install pyasn1
Run Code Online (Sandbox Code Playgroud)

解决方案:

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