[英]How to use google cloud vision with Google App Engine Python?
I am trying to use https://cloud.google.com/vision/ in my Google App Engine Python application. 我正在尝试在我的Google App Engine Python应用程序中使用https://cloud.google.com/vision/ 。 Are there examples for using it?
有使用示例吗?
I followed the tutorial: https://www.programmableweb.com/news/how-to-build-monitoring-application-google-cloud-vision-api/how-to/2016/03/29?page=4 我遵循了该教程: https : //www.programmableweb.com/news/how-to-build-monitoring-application-google-cloud-vision-api/how-to/2016/03/29?page=4
and 和
I am getting an error when I use the following after enabling the Cloud-Vision API in the API manager: 在API管理器中启用Cloud-Vision API后,使用以下命令时出现错误:
from googleapiclient.discovery import build
from oauth2client.client import GoogleCredentials
Error 错误
from googleapiclient.discovery import build
ImportError: No module named googleapiclient.discovery
Am I missing a dependency configuration? 我是否缺少依赖项配置?
You should be able to use their official client libraries in your app engine project like any other API. 您应该能够像其他任何API一样在您的App Engine项目中使用其官方客户端库。 Just make sure to enable the specific API for your specific project in the API Manager [0].
只需确保在API管理器[0]中为特定项目启用了特定API。
There's also a repo with sample code for various languages although not app engine specific [1] 虽然不是特定于应用程序引擎的,但也有一个包含各种语言的示例代码的回购库[1]
Accessing Google APIs from Python 从Python访问Google API
For your App Engine project, run this to install the client library first. 对于您的App Engine项目,请运行此程序以首先安装客户端库。 This is considered a third party library, so you will need some initial setup for your app engine project as described here [2] -
这被视为第三方库,因此您将需要对App Engine项目进行一些初始设置,如此处所述[2]-
$ mkdir lib
$ pip install --upgrade -t lib google-api-python-client
Create a file appengine_config.py
with the following content - 创建具有以下内容的文件
appengine_config.py
# appengine_config.py
from google.appengine.ext import vendor
# Add any libraries install in the "lib" folder.
vendor.add('lib')
You can find more information about the client library here - 您可以在此处找到有关客户端库的更多信息-
https://developers.google.com/api-client-library/python/ https://developers.google.com/api-client-library/python/
Feel free to update your question with more specific issues you are having including some sample code you've tried and I'd be happy to provide more assistance. 随时用您遇到的更具体的问题来更新您的问题,包括您尝试过的一些示例代码,我们很乐意提供更多帮助。
[0] https://console.cloud.google.com/apis/api/vision.googleapis.com/overview [0] https://console.cloud.google.com/apis/api/vision.googleapis.com/overview
[1] https://github.com/GoogleCloudPlatform/cloud-vision [1] https://github.com/GoogleCloudPlatform/cloud-vision
[2] https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#vendoring [2] https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#vendoring
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.