google-api-python-client 相关问题

适用于Python的Google API客户端库提供对Google基于发现的API的访问。它专为Python客户端应用程序开发人员设计,提供简单,灵活,强大的API访问。

Google API Python 客户端 Firebase 应用程序分发 HTTP 400

我正在尝试列出在 google-api-python-client 的帮助下上传到 Firebase App Distribution 的构建,但是我总是收到 HTTP 状态代码 400。 我创建了一个服务ac...

回答 1 投票 0

以管理员身份获取我的 Google 工作区用户的电子邮件

我目前正在尝试获取我的谷歌工作区用户的所有电子邮件(我有一个管理员帐户)! 我首先在控制台上执行这些步骤。 在 Google Cloud Platform (GCP) Con... 中创建项目...

回答 2 投票 0

在 GCP 中的策略中添加角色时,策略成员必须以“<type>:<value>”形式作为前缀错误

我编写了此类来添加/更新我的 Google Cloud 项目中的角色和成员。 类策略管理器: """用于管理 Google Cloud 中的角色的策略管理器""" ...

回答 1 投票 0

如何使用 Python SDK 和内联凭据向 Google Gemini Pro Vision AI 进行身份验证?

我正在尝试使用 Google 的 Vertex Python SDK,但我不想随身携带凭证.json 文件。我宁愿将文件的秘密部分存储在 Key Vault 中并在运行时插入。但我不能...

回答 1 投票 0

如何从 Google API 响应对象创建 Pandas Dataframe

我正在尝试将 Google Analytics Admin API 响应获取到 Pandas 数据帧中,但在解析结果时遇到问题。我正在 admin_v1beta 中使用列表 customDimensions 方法

回答 1 投票 0

Google API OAuth 2.0-redirect_uri_mismatch

我在 StackOverflow 上阅读了大量有关此问题的帖子,但没有一个反映我的情况(例如,其他帖子中的解决方案是我已经完成的事情,呃...

回答 1 投票 0

Google 身份验证 API 在几次后没有刷新

我遵循了谷歌API身份验证步骤,它最初有效,但几天后遵循相同的步骤并重新下载“秘密”给了我上述错误,我认为这...

回答 1 投票 0

将机器学习模型部署到 Google 云的 AI 平台时,出现 HttpError 403,原因为 CONSUMER_INVALID

我正在按照此处的教程(https://cloud.google.com/ai-platform/training/docs/training-jobs#python_1)并使用Python将机器学习模型部署到Google云进行训练。然而...

回答 2 投票 0

Google DV360 API 报告:如何获取展示次数、点击次数等绩效指标

我正在尝试使用python从DV360 API中提取报告。我能找到的唯一方法是使用sdfdownloadtask。使用sdfdownloadtask我能够获取报告,但报告没有

回答 1 投票 0

Google Calendar API 对 token.json 的理解

我正在使用 Google 日历 API,特别是 python 快速入门,但语言并不重要。 https://developers.google.com/calendar/api/quickstart/python 中的示例具有: ...

回答 1 投票 0

Google Oath2 库在调用 flow.InstalledAppFlow.from_client_secrets_file() 时引发 CSRF 警告

我有以下Python代码: 范围 = ['https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/gmail.compo...

回答 1 投票 0

在单个 api 请求中将多个视频添加到 youtube-播放列表 (Python)

所以我有这个脚本可以提取用户喜欢的视频并创建一个包含所有喜欢的视频的公共播放列表,但由于有配额限制,我每天不能添加超过 200 个视频(playlistIte...

回答 1 投票 0

如何使用 Google API 和身份验证/服务帐户从 https://docs.google.com/spreadsheets 下载文件?

我想每天从 https://docs.google.com/spreadsheets 帐户(服务帐户)自动下载文件。 我有一个 cred.json 文件,其中包含: { “类型”:“service_acc...

回答 1 投票 0

来自 Google Workspace 的用户邮箱使用情况报告

我正在尝试获取基本的电子邮件使用情况报告。我们需要获取用户名及其电子邮箱的大小。下面提供的代码抛出异常 ” 我正在尝试获取基本的电子邮件使用情况报告。我们需要获取用户名及其电子邮箱的大小。下面提供的代码抛出异常 ”https://admin.googleapis.com/admin/directory/v1/users?alt=json 返回“错误请求”。详细信息:“[{'message': '错误请求', 'domain': ' global', 'reason': 'badRequest'}]">**" 就行了 users = service.users().list().execute() 完整代码如下: from __future__ import print_function import os.path import csv import io from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build # If modifying these scopes, delete the file token.json. #SCOPES = ['https://www.googleapis.com/auth/admin.directory.user.readonly'] SCOPES = ['https://admin.googleapis.com/admin/directory/v1/users'] creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.json'): creds = Credentials.from_authorized_user_file('token.json', SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open('token.json', 'w') as token: token.write(creds.to_json()) service = build('admin', 'directory_v1', credentials=creds) print('Getting users in the domain') users = service.users().list().execute() # Create a dictionary to store the user data. user_data = {} # Iterate over the list of users and get their first name, last name, and mailbox size. for user in users["users"]: user_data[user["primaryEmail"]] = { "firstName": user["name"]["givenName"], "lastName": user["name"]["familyName"], "mailboxSize": user["storage"]["quotaUsage"], } # Open the CSV file for writing. with open("user_data.csv", "w", newline="") as f: writer = csv.writer(f) # Write the header row. writer.writerow(["email", "firstName", "lastName", "mailboxSize"]) # Iterate over the user data and write each user's data to a new row in the CSV file. for email, data in user_data.items(): writer.writerow([email, data["firstName"], data["lastName"], data["mailboxSize"]]) # Close the CSV file. f.close() 凭证正确。测试多次。正如您从示例中看到的,我尝试使用不同的范围。 我在这里做错了什么? 你错过了你的customer='my_customer': from __future__ import print_function import os.path from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build # If modifying these scopes, delete the file token.json. SCOPES = ['https://www.googleapis.com/auth/admin.directory.user'] USER_TOKEN = "token_create_user.json" CREDENTIALS = 'C:\Development\FreeLance\GoogleSamples\Credentials\Workspace-Installed-TestEverything.json' def main(): """Shows basic usage of the Admin SDK Directory API. Prints the emails and names of the first 10 users in the domain. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists(USER_TOKEN): creds = Credentials.from_authorized_user_file(USER_TOKEN, SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( CREDENTIALS, SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open(USER_TOKEN, 'w') as token: token.write(creds.to_json()) service = build('admin', 'directory_v1', credentials=creds) # Call the Admin SDK Directory API print('Getting the first 10 users in the domain') results = service.users().list(customer='my_customer', maxResults=10, orderBy='email').execute() users = results.get('users', []) if not users: print('No users in the domain.') else: print('Users:') for user in users: print(u'{0} ({1})'.format(user['primaryEmail'], user['name']['fullName'])) if __name__ == '__main__': main()

回答 1 投票 0

如何使用google customsearch API查询高级搜索?

我如何以编程方式使用 Google Python 客户端库使用 Google 自定义搜索 API 搜索引擎进行高级搜索,以便返回基于某些术语的前 n 个链接的列表,并且

回答 4 投票 0

400 通过 GCStorage URI 在语音转文本 v2 中请求音频最多可达 10485760 字节

我正在使用 google voice-to-text-v2 API 通过 Chirp 模型进行转录。 我正在尝试转录一个超过 10 分钟的音频文件。由于 l...

回答 1 投票 0

在dialogflow cx中将声音更改为女性

如何使用 Dialogflow CX 中的 API(Python 客户端库)将声音更改为女性?我们尝试了本文档中提到的步骤,但没有任何效果。(https://cloud.google.com/dialogflow/cx/...

回答 2 投票 0

尝试导出 GDrive 工作区文件时出现文件权限不足错误

尝试导出 GDrive 工作区文件时遇到文件权限不足错误。 错误: googleapiclient.http:遇到 403 Forbidden,原因为“insufficientFilePermissions” <

回答 2 投票 0

列出 Google 云端硬盘文件和文件夹

我想创建一个简单的Python脚本来递归地列出特定文件夹ID的文件/文件夹。 以下脚本部分有效。作为起始文件夹,我使用 ID“root”作为...

回答 1 投票 0

Google Cloud - Resource_manager Python 模块问题

我正在为 Google Cloud 准备自动化。我正在使用本机 Python 模块。我所有的代码都存储在 GIT 存储库中。我正在使用 PyCharm,并且我在 PyCharm 中添加了文件源以便使用 GIT...

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.