在Python Appengin上使用Httplib2

2024-06-08 14:59:47 发布

您现在位置:Python中文网/ 问答频道 /正文

为什么在运行试图用Foursquare进行OAuth的应用程序时会出现此错误?

import httplib2
ImportError: No module named httplib2

我已经通过下载httplib2并在命令行上按指示安装$python setup.py安装了它here

我遗漏了什么吗?谢谢


Tags: no命令行pyimport应用程序错误setupoauth
3条回答

您需要在项目中包含库,以便应用程序引擎运行时知道您要导入的内容。

来自here

You can include other pure Python libraries with your application by putting the code in your application directory. If you make a symbolic link to a module's directory in your application directory, appcfg.py will follow the link and include the module in your app.

添加httplib2作为第三方库,如下所述:

https://cloud.google.com/appengine/docs/python/tools/libraries27#vendoring

安装方式:

pip install -t lib httplib2

我已经创建了一个简单的例子来说明在使用Google App Engine时如何做到这一点。(https://github.com/muanis/foursquare-oauth-bootstrap)基本上需要Google oAuth2客户端(http://code.Google.com/p/Google-api-python-Client/)和httplib2(http://code.Google.com/p/httplib2/)

相关问题 更多 >