google / gdata-python-client

443 stars 227 forks source link

Could not use AuditService. #48

Open openedhardware opened 8 years ago

openedhardware commented 8 years ago

Hi. I want to download entire mailbox of a user.

My code is this:


my_domain = "test.com"
dest_user = 'user@test.com'

client = gdata.apps.audit.service.AuditService(domain=my_domain)

scope = ['https://apps-apis.google.com/a/feeds/compliance/audit/']

credentials = ServiceAccountCredentials.from_json_keyfile_name('my_credential.json', scopes=scope)

http = credentials.authorize(httplib2.Http())

client.createMailboxExportRequest(dest_user)

But it says that I need authorization.

I have spared 2 days to find a sample code of oAuth2 authentication, but failed. All samples are used ClientLogin function which is already removed last year.

I will be very appreciated if anyone could help me. Thanks.