带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}$非常感谢您的关注
卡洛斯·普里托
从AdminSettings API using service account auth/keyword failures看来gdata服务对象不支持oauth2.0,我在使用gdatacontacts服务对象时遇到了类似的错误,通过使用contacts客户机对象解决了这个问题。管理设置应用程序似乎没有客户端,只有一个服务,但链接的stackoverflow页面有一个解决办法。在
相关问题 更多 >
编程相关推荐