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.

Here's some code for what I've got:

FLOW = OAuth2WebServerFlow(
    client_id='client_id.apps.googleusercontent.com',
    client_secret='***',
    redirect_uri='urn:ietf:wg:oauth:2.0:oob',
    scope='https://www.googleapis.com/auth/apps/reporting/audit.readonly',
    user_agent='audit-cmdline-sample/1.0')
  # 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',
        actorEmail='[email protected]').execute()
    print_activities(activity_list)

Any clues as to what might be going on?


-- 
You received this message because you are subscribed to the Google Groups 
"Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-apps-mgmt-apis/-/ApeJiXtZNTYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Reply via email to