python - Google Identity Toolkit (v3) 是否与 GAE/python 沙箱兼容?

标签 python google-app-engine google-identity-toolkit

我正在为一个网站开发一个 python GAE 应用程序,并且正在尝试对其进行联合登录。

根据Identity Platform choosing guide网站的最佳解决方案似乎是 Google Identity Toolkit (web) 。浏览了我能找到的所有相关文档,然后转到教程,在那里我遇到了一个障碍 - 安装 identity-toolkit-python-client 包失败,并出现与 相关的 C 编译错误cffi 库,类似于这个:

# python -m pip install identity-toolkit-python-client
...
gcc -pthread -fno-strict-aliasing -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python2.7 -c src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c -o build/temp.linux-x86_64-2.7/src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.o

src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c:2:20: fatal error: Python.h: No such file or directory

 #include <Python.h>

                    ^

compilation terminated.

error: command 'gcc' failed with exit status 1

在为我的 Linux 发行版安装一些特定的软件包后,我最终成功地正确安装了该软件包,但这些失败导致了我的实际问题(教程非常通用,我找不到任何有关 GAE 限制的提示)。

来自GAE python sandbox documentation GAE 应用程序中应该只存在纯 python 代码:

All code for the Python runtime environment must be pure Python, and not include any C extensions or other code that must be compiled.

我没有看到 GAE SDK 或其第 3 方库中包含身份工具包,据我所知,这意味着我必须 install it as a 3rd party library在我自己的应用程序中。但纯 python 代码限制也适用于这些库:

You can add any third-party library to your application, as long as it is implemented in "pure Python" (no C extensions) and otherwise functions in the App Engine runtime environment.

因此标题中的问题。

我错过了什么吗?

谢谢。

到目前为止,我正在使用 webapp2 和 jinja2。

最佳答案

这并不能保证 100%,受支持的第 3 方库(如 PyCrypto、numpy lxml)都有基于“C”的扩展,但这些都由 google 直接支持。您只是无法添加不在列表中的您自己的内容。

请参阅第 3 方库文档 https://cloud.google.com/appengine/docs/python/tools/libraries27

您必须区分 Google 支持的“第 3 方库”与您自己提供的第 3 方库。

而且你还没有说你正在使用什么框架。您可能会发现值得一看自动http://peterhudec.github.io/authomatic/

开箱即用的支持:

  • OAuth 1.0a 提供商:Bitbucket、Flickr、Meetup、Plurk、Twitter、 Tumblr、UbuntuOne、Vimeo、Xero、Xing 和雅虎。 OAuth 2.0 提供商: 亚马逊、Behance、Bitly、Cosm、DeviantART、Eventbrite、Facebook、 Foursquare、GitHub、谷歌、LinkedIn、PayPal、Reddit、Viadeo、VK、 WindowsLive、Yammer 和 Yandex。 python-openid 和 Google App Engine 基于 OpenID。

关于python - Google Identity Toolkit (v3) 是否与 GAE/python 沙箱兼容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31082344/

相关文章:

python - 如何从 Kaggle 的 MNIST 训练神经网络中获得正确的预测?

java - Google App Engine 数据存储区-主键

session - 为什么 GITkit.idToken 应该被 Session Token 取代?

google-api - Google API Explorer 和 Google Identity Toolkit API 无法正常工作

java - 使用 Google Identity Toolkit 进行 App Engine 端点身份验证

python - Django 最佳实践。形式

python - 为什么 python 在导入 A.B.C 时将 'A' 放入全局命名空间

python - 动态规划解决两指打字最短距离问题

google-app-engine - 在 GoDaddy 上设置重定向 www 到裸域后出现 GAE 错误 404

java - Google 表示 JDO 不会从 Datastore 进行级联删除。你是怎么做到的?