python - gdata.apps.audit.service authentication without ClientLogin -
python - gdata.apps.audit.service authentication without ClientLogin -
i want utilize gdata.apps.audit.service.auditservice create mailbox export requests (specifically via createmailboxexportrequest). possible access api authenticating via oauth or means? i'm trying avoid requiring user provide username , password.
here illustration piece of code:
audit_service = gdata.apps.audit.service.auditservice(domain="test.com") #would not utilize clientlogin client = audit_service.clientlogin("adm_user@test.com", "supersecretpassword") # <------ audit_service.createmailboxexportrequest(user="target_user", begin_date=none, end_date=none, include_deleted=true, search_query=none) audit_service.getallmailboxexportrequestsstatus()
i'm using oauth2/client_secrets other admin/audit apis can't figure out how createmailboxexportrequest without clientlogin. help appreciated.
the easiest way i've found hack oauth 2.0 older gdata apis build gdata service (but not authorize it), build credentials service newer oauth 2.0 discovery google apis, add together proper credentials header on gdata service:
audit_service = gdata.apps.audit.service.auditservice(domain="test.com") ... # build credentials normal oauth2client auth_headers = {u'authorization': u'bearer %s' % credentials.access_token} audit_service.additional_headers = auth_headers
python oauth-2.0 gmail google-admin-sdk google-admin-audit-api
Comments
Post a Comment