【发布时间】:2016-02-23 22:27:59
【问题描述】:
我正在将paypalrestsdk 集成到我的 AppEngine 项目中。当我使用我的本地 dev_appserver 尝试在 PayPal 沙箱上创建付款时,出现以下错误:
SSLCertificateError: Invalid and/or missing SSL certificate for URL: https://api.sandbox.paypal.com/v1/oauth2/token
所以,我尝试提供正确的 pem 文件,从 here 下载并设置正确的 ssl_option 属性:
# Setting up the correct path to the .pem file
cert = os.path.join(ROOT, 'certs/api.sandbox.paypal.com_SHA-2_01132018.pem')
logger.info("Using SSL certificate: %s", cert)
return Api(
mode=get_paypal_environment(), # sandbox or live
client_id=flask.current_app.config["PAYPAL_CLIENT_ID"],
client_secret=flask.current_app.config["PAYPAL_CLIENT_SECRET"],
ssl_options={"cert": cert}
)
Here PayPalRestSDK 文档提供了有关如何提供证书的详细信息。我已经仔细检查了创建的路径是否正确。
我发现了一个错误报告here,它谈到了一个类似的问题。
另外,我已经尝试了here 建议的解决方案,但仍然无法正常工作。
在实时实例上,在 apppot 上,这一切都可以完美运行。
这是我的 requirements.txt 的相关部分:
Flask==0.10.1
itsdangerous==0.24
paramiko==1.15.1
pycrypto==2.6.1
Flask-OAuthlib==0.9.1
google-api-python-client==1.4.0
paypalrestsdk==1.11.1
requests[security]==2.9.1
有人遇到同样的问题吗?
【问题讨论】:
-
我遇到了同样的问题。它绝对可以在我的设置中使用,并且我没有在代码的那个区域进行任何更改来破坏它。
标签: python google-app-engine ssl-certificate paypal-rest-sdk dev-appserver-2