标签: google-api-python-client

Google App Engine库导入

我一直在尝试使用Google App Engine,我正在尝试导入某些库以执行API命令.然而,我一直无法导入.当我尝试执行"来自apiclient.discovery import build"时,我的网站不再加载.当我在IDLE中进行本地测试时,此命令有效.

python google-app-engine google-api google-api-client google-api-python-client

0
推荐指数
1
解决办法
2096
查看次数

0
推荐指数
1
解决办法
395
查看次数

pip 错误:找不到与 google-api-python-client 匹配的分发版

我正在遵循这篇关于 Firebase 和 Google App Engine 的博文中概述的步骤

https://firebase.googleblog.com/2017/03/how-to-schedule-cron-jobs-with-cloud.html

当我尝试运行时:

pip install -t lib -r requirements.txt
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Could not fetch URL https://pypi.python.org/simple/google-api-python-client/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping
  Could not find a version that satisfies the requirement google-api-python-client (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for google-api-python-client (from -r requirements.txt (line 1))
You are using pip version 9.0.1, however version 9.0.3 is available.
You should …
Run Code Online (Sandbox Code Playgroud)

pip google-api-python-client

0
推荐指数
1
解决办法
9140
查看次数

谷歌服务帐户凭据不起作用

我正在尝试创建一个简单的网络应用程序,自动将我的数据库和媒体备份上传到指定的谷歌驱动器。我按照官方文档创建了一个服务帐户凭据,赋予其所有者角色,并从 Google 云平台提取了密钥(json 文件)。我在我的帐户上启用了 Google Drive API 并编写了此代码,但credentials.valid 返回 False,并且我的文件不会上传到我的驱动器。

from google.oauth2 import service_account
import googleapiclient as google
from googleapiclient.http import MediaFileUpload, HttpRequest
from googleapiclient.discovery import build

SCOPES = ['https://www.googleapis.com/auth/drive']

credentials = service_account.Credentials.from_service_account_file('./service-credentials.json', scopes=SCOPES)

print(credentials.valid)

service = build('drive', 'v3', credentials=credentials)
file_metadata = {'name' : 'python.png'}
media = MediaFileUpload('./python.png', mimetype='image/png')
file_up = service.files().create(body=file_metadata, media_body=media, fields='id').execute()

file_back = service.files().get(fileId=file_up['id']).execute()

print(file_back.get('WebContentLink'))

Run Code Online (Sandbox Code Playgroud)

python google-api google-drive-api google-oauth google-api-python-client

0
推荐指数
1
解决办法
4258
查看次数