我正在将paypalrestsdk集成到我的 AppEngine 项目中。当我使用本地 dev_appserver尝试在 PayPal 沙箱上创建付款时,出现以下错误:
SSLCertificateError: Invalid and/or missing SSL certificate for URL: https://api.sandbox.paypal.com/v1/oauth2/token
所以,我试图提供正确的 pem 文件,从这里下载并设置正确的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}
)
这里有 PayPalRestSDK 文档,其中提供了有关如何提供证书的详细信息。我已经仔细检查了创建的路径是否正确。
我在这里找到了一个关于类似问题的错误报告。
另外,我尝试了此处建议的解决方案,但仍然无法正常工作。
在实时实例上,在 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
有没有人有同样的问题?