我正在使用Python Stripe包.我收到了错误Stripe no longer supports API requests made with TLS 1.0
.我在Mac上使用Python 2.7.我该如何解决?
# Set this to your Stripe secret key (use your test key!)
stripe.api_key = "sk_test_VAjLc9DN9BXMS3GPvFn5W92c"
# Get the credit card details
token = info['stripeToken']
amount = info['amount']
description = info['description']
# Create the charge on Stripe's servers - this will charge the user's card
charge = stripe.Charge.create(
amount=amount,
currency="usd",
card=token,
description=description
)
Run Code Online (Sandbox Code Playgroud)
Traceback (most recent call last):
File "/Users/vertace/Desktop/payableApp-Sumup/payableAppServer.py", line 23, in pay
description=description
File "/Library/Python/2.7/site-packages/stripe/resource.py", line 466, in create
response, api_key = requestor.request('post', url, params, headers)
File "/Library/Python/2.7/site-packages/stripe/api_requestor.py", line 140, in request
resp = self.interpret_response(rbody, rcode, rheaders)
File "/Library/Python/2.7/site-packages/stripe/api_requestor.py", line 288, in interpret_response
self.handle_api_error(rbody, rcode, resp, rheaders)
File "/Library/Python/2.7/site-packages/stripe/api_requestor.py", line 163, in handle_api_error
rheaders)
AuthenticationError: Request req_A4IYdjtgwILuyV: Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.
Run Code Online (Sandbox Code Playgroud)
小智 5
pip install pyopenssl
pip uninstall requests
pip install requests
Run Code Online (Sandbox Code Playgroud)