简体   繁体   English

Django paypalrestsdk错误-OpenSSL.SSL.Error:[(“ SSL例程”,“ tls_process_server_certificate”,“证书验证失败”))

[英]Django paypalrestsdk error - OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]

I am programming on Django and using paypalrestsdk https://github.com/paypal/PayPal-Python-SDK 我在Django上编程并使用paypalrestsdk https://github.com/paypal/PayPal-Python-SDK

I am getting this error: 我收到此错误:

OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]

Basically I have created BillingPlan(code snippet https://gist.github.com/axilaris/2f9cf8f5c27a8a2095c5c9abf0dc4121 ), and this appears: 基本上我已经创建了BillingPlan(代码段https://gist.github.com/axilaris/2f9cf8f5c27a8a2095c5c9abf0dc4121 ),这看起来是:

Payment created successfully
2018-05-08 22:44:45,358 INFO Request[POST]: https://api.sandbox.paypal.com/v1/oauth2/token
2018-05-08 22:44:45,358 DEBUG Level: sandbox
2018-05-08 22:44:45,358 DEBUG Request: 
Headers: {'Authorization': 'Basic QVZ2cEhjMExScXFkcEFQZy1QZm1DU19jVlFNYTV1V3lsaXpBMXRpMDRjcm4tZF9jbWdyVFF5N0ZQOVZOcnlfdXRZN0IwZk91cEJSQlluVzM6RUpIcV9GLWwxbmNJLTY3YmFLYmREcWRJMVMtcGNOWkxwWjdvX29mcG10eGQ4ZlVRM2drQTFQR1J5ZzBOZER6VDY1dE5URlY2Y29lWDVVdHM=', 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json', 'User-Agent': 'PayPalSDK/PayPal-Python-SDK 1.13.1 (requests 2.12.1; python 3.6.3; OpenSSL 1.0.2k 26 Jan 2017)', 'PayPal-Request-Id': 'b337cb66-b036-4a0a-9f70-aaa7011e73bb'}
Body: grant_type=client_credentials
2018-05-08 22:44:45,362 DEBUG Starting new HTTPS connection (1): api.sandbox.paypal.com
From cffi callback <function _verify_callback at 0x12972a268>:
Traceback (most recent call last):
File "/Users/some/Documents/project/somedotcom/somedotcomenv/lib/python3.6/site-packages/OpenSSL/SSL.py", line 313, in wrapper
_lib.X509_up_ref(x509)
...
File "/Users/some/Documents/project/somedotcom/somedotcomenv/lib/python3.6/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]

more complete detail of the traces can be found here: https://gist.github.com/axilaris/c181aaaa8261add4240fb2d042bd1ffc 有关跟踪的更多详细信息,请参见: https//gist.github.com/axilaris/c181aaaa8261add4240fb2d042bd1ffc

How do I resolve this error ? 如何解决此错误? Thanks. 谢谢。

my environment: 我的环境:

pyOpenSSL==17.5.0
paypalrestsdk==1.13.1 
Django==1.11.7
cryptography==2.1.3

PayPal's APIs require TLS 1.2 and my guess is that your underlying installed version of OpenSSL is a bit too old to support it. 贝宝(PayPal)的API 需要TLS 1.2 ,我的猜测是您安装的OpenSSL的基础版本太旧了,无法支持它。

Use the following to determine what version of OpenSSL you've got installed: 使用以下命令确定已安装的OpenSSL版本:

>>> import ssl
>>> print ssl.OPENSSL_VERSION
OpenSSL 1.0.2m  2 Nov 2017

If you're on anything lower than 1.0.1, you'll likely want to upgrade it using brew . 如果您使用的版本低于1.0.1,则可能需要使用brew对其进行升级 In my experience, Mac OS X can have quite antiquated versions of it; 以我的经验,Mac OS X可能具有过时的版本。 I think mine was as low as 0.9.8. 我认为我的低至0.9.8。

Once you've upgraded OpenSSL and confirmed that in the python shell you see the new version, you can test it by running your code. 升级OpenSSL并确认在python shell中看到新版本后,可以通过运行代码进行测试。 If it still doesn't work, I suggest running the following to get some more fine-grained detail on the connection health: 如果仍然无法正常工作,我建议运行以下命令以获取有关连接状况的更多详细信息:

openssl s_client -showcerts -connect api.sandbox.paypal.com:443

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Hashicorp python 客户端暖通空调问题:-“握手错误:错误([(&#39;SSL 例程&#39;,&#39;tls_process_server_certificate&#39;,&#39;证书验证失败&#39; - Hashicorp python client hvac issue:- "bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed' SSL错误:例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 - SSL error : routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 身份验证失败:[Errno 1] _ssl.c:510:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 - Authentication failed: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed SSLError:[Errno 1] _ssl.c:510:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败 - SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 使用PFX证书的Python请求将不起作用! -OpenSSL.SSL.Error:[(&#39;PEM例程&#39;]-是否需要PFX到PEM的转换? - Python Requests using PFX certificate wont work ! - OpenSSL.SSL.Error: [('PEM routines'] - PFX to PEM conversion necessary? 在python中抑制&#39;SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败&#39;错误 - Suppress 'SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' errors in python python请求SSL错误(证书验证失败) - python Requests SSL ERROR (certificate verify failed) Python SSL错误CERTIFICATE_VERIFY_FAILED - Python SSL error CERTIFICATE_VERIFY_FAILED urllib 和“SSL:CERTIFICATE_VERIFY_FAILED”错误 - urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error Python 请求 SSL 错误 - 证书验证失败 - Python requests SSL error - certificate verify failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM