Hi, I'm trying to set up a Python script to access the Admin Audit tool on our education domain. We've got Code enabled on the domain, and I've set up an Installed Application there to manage access. So, I've got a client_id and a client_secret set up here, and am using that to try to set up an OAuth2 flow. I've been unable to do so, as yet, and keep getting an "Access Not Configured" error. I'm seeing some indication that I might need to use an API key, from looking at other postings, but the documentation within Code is saying that this would prevent us from getting an user level data, which is exactly what the Admin Audit tool should provide, so I don't think I want to do that.
# If the Credentials don't exist or are invalid run through the native client
# flow. The Storage object will ensure that if successful the good
# Credentials will get written back to a file.
storage = Storage('audit.dat')
credentials = storage.get()
if credentials is None or credentials.invalid == True:
credentials = run(FLOW, storage)
# Create an httplib2.Http object to handle our HTTP requests and authorize it
# with our good Credentials.
http = httplib2.Http()
http = credentials.authorize(http)
service = build('audit', 'v1', http=http)
try:
activities = service.activities()
# Retrieve the first two activities
print 'Retrieving the first 2 activities...'
activity_list = activities.list(
applicationId='207535951991', customerId='***', maxResults='2',
print_activities(activity_list)