gdata和python中oauth2的管理设置API

2024-10-04 09:24:32 发布

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

带oauth2的管理设置API

我试图将用python编写的应用程序连接到具有OAuth2凭据的管理设置API,但遇到错误:

源代码:

from oauth2client.client import Credentials
import gdata.apps.adminsettings.service
import gdata.gauth

#credentials_json is a string with an oauth2 credential that is saved in datastore
#domain_name is the name of the target domain
#app_name is my application name

credentials = Credentials.new_from_json(credentials_json)
auth2token = gdata.gauth.OAuth2TokenFromCredentials(credentials)
service = gdata.apps.adminsettings.service.AdminSettingsService(source=app_name,domain=domain_name)
service = auth2token.authorize(service)

print service.GetMaximumNumberOfUsers()

例外情况:

^{pr2}$

非常感谢您的关注

卡洛斯·普里托


Tags: appsnamefromimportapijsonisdomain
1条回答
网友
1楼 · 发布于 2024-10-04 09:24:32

AdminSettings API using service account auth/keyword failures看来gdata服务对象不支持oauth2.0,我在使用gdatacontacts服务对象时遇到了类似的错误,通过使用contacts客户机对象解决了这个问题。管理设置应用程序似乎没有客户端,只有一个服务,但链接的stackoverflow页面有一个解决办法。在

相关问题 更多 >