使用Python API库在Google AppEngine上支付条带付款

时间:2014-05-10 10:16:35

标签: python google-app-engine stripe-payments

我刚刚将Stripe API库更新到最新版本,并且由于GAE阻止了某些软件包(如套接字和SSL)的导入,因此它停止了在Google AppEngine上工作。

ERROR    2014-05-10 09:55:16,576 base.py:215] Internal Server Error: /api/billing/subscribe_to_paid_plan/stripe
    Traceback (most recent call last):
...
     File "/src/classes/billing/api_views.py", line 3, in <module>
        import stripe
      File "/src/stripe/__init__.py", line 16, in <module>
        from stripe.resource import (  # noqa
      File "/src/stripe/resource.py", line 5, in <module>
        from stripe import api_requestor, error, util
      File "/src/stripe/api_requestor.py", line 5, in <module>
        import ssl
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 60, in <module>
        import _ssl             # if we can't import it, let the error propagate
      File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 852, in load_module
        raise ImportError('No module named %s' % fullname)
    ImportError: No module named _ssl

有没有机会让它在Google AppEngine上运行?

1 个答案:

答案 0 :(得分:7)

您需要通过将以下内容添加到app.yaml:

来启用SSL
libraries:
- name: ssl
  version: latest
编辑:下面的错误尚未修复,但我为条纹python绑定提供了一个补丁来解决它。

app引擎服务器目前存在一个错误(它在我的待办事项列表中尝试修复它),可以通过执行以下操作来规避这个错误:

将“_ssl”和“_socket”键添加到_WHITE_LIST_C_MODULES

中的词典/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py

socket.py中的google提供的/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dis27文件替换为Python框架中的socket.py文件。