Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于python的Google共享联系人API_Python_Google Contacts Api - Fatal编程技术网

用于python的Google共享联系人API

用于python的Google共享联系人API,python,google-contacts-api,Python,Google Contacts Api,我想使用python来添加/更新在g套件域中共享给所有用户的外部联系人,我在试图找出如何添加/更新外部联系人时遇到了问题。查看中的文档,看起来该过程涉及谷歌登录,但是在我正在开发的应用程序中,我不希望用户向谷歌提供凭据/登录,所有授权过程都将在服务器端完成 这是我目前用于获取用户联系人的代码,我想知道是否可以使用服务帐户/p12键执行类似于获取/添加/更新外部联系人的操作: from googleapiclient.discovery import build from oauth2client

我想使用python来添加/更新在g套件域中共享给所有用户的外部联系人,我在试图找出如何添加/更新外部联系人时遇到了问题。查看中的文档,看起来该过程涉及谷歌登录,但是在我正在开发的应用程序中,我不希望用户向谷歌提供凭据/登录,所有授权过程都将在服务器端完成

这是我目前用于获取用户联系人的代码,我想知道是否可以使用服务帐户/p12键执行类似于获取/添加/更新外部联系人的操作:

from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials

credentials = ServiceAccountCredentials.from_p12_keyfile(
 SERVICE_ACCOUNT_EMAIL,
 P12_FILE_PATH,
 KEY_SECRET,
 scopes=[
 'https://www.googleapis.com/auth/admin.directory.user'
 ]
)

credentials = credentials.create_delegated(SUPER_ADMIN_EMAIL)
admin = build('admin', 'directory_v1', credentials=credentials)

admin.users().get(userKey=user_email).execute()

谢谢

这可能是离题了。