Skip to content Skip to sidebar Skip to footer

Adminsettings Api Using Service Account Auth/keyword Failures

Trying to retreive domain number of users, 'GetCurrentNumberOfUsers()', using AdminSettings API via a Service Account in Python. Enabled delegation wide authority and scope, but ge

Solution 1:

The old GData Python library service objects don't actually support OAuth 2.0 which is what you need to be using. However you can hack a access token on there. Try something like:

credentials = SignedJwtAssertionCredentials(SERVICE_ACCOUNT_EMAIL, key, scope='https://apps-apis.google.com/a/feeds/domain/', sub='admin@xxxtestmail.edu')
credentials.refresh(httplib2.Http())
service = gdata.apps.adminsettings.service.AdminSettingsService(source="testApp", domain='xxxtestmail.edu')
service.additional_headers[u'Authorization'] = u'Bearer {0}'.format(credentials.access_token)

print service.GetCurrentNumberOfUsers()

Post a Comment for "Adminsettings Api Using Service Account Auth/keyword Failures"