Email Audit API | Python Help Please

137 views
Skip to first unread message

Damon Douglas

unread,
Sep 5, 2011, 11:44:13 AM9/5/11
to google-app...@googlegroups.com
To Whom It May Concern:

I am getting the exception:

   raise gdata.apps.service.AppsForYourDomainException(e.args[0])
AppsForYourDomainException: {'status': 403, 'body': '<HTML>\n<HEAD>\n<TITLE>Invalid domain.</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Invalid domain.</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n', 'reason': 'Invalid domain.'}

My code is:

import gdata.calendar.service
import gdata.apps.audit.service

email = "[email address]"
password = "somepassword"
source = "damondouglas-emailaudit-v1.0"

source_user = "[email address]"
destination_user = "[email address]"
end_date = "2011-12-31 01:00"

client = gdata.apps.audit.service.AuditService()
client.ClientLogin(email, password, account_type='HOSTED', source=source)

client.createEmailMonitor(source_user, destination_user, end_date, begin_date=None, incoming_headers_only=False, outgoing_headers_only=False,  
                                                    drafts=True, drafts_headers_only=False, chats=True, chats_headers_only=False)


I am using python 2.7.2 on Mac OS 10.7.1.  Thank you for your help.

Regards,

Damon
Message has been deleted

Gunjan Sharma

unread,
Sep 6, 2011, 1:47:08 PM9/6/11
to google-app...@googlegroups.com
Hello Damon

While creating the object of the AuditService you need to give the domain on which you will be using it like this:

client = gdata.apps.audit.service.AuditService(domain="Your_domain")
OR you can also set it like this
client.domain="Your_domain"

This will set the domain in your object, which otherwise is None.

Thanks
Gunjan Sharma

Damon Douglas

unread,
Sep 6, 2011, 6:56:55 PM9/6/11
to google-app...@googlegroups.com
Thank you, Gunjan.  This was very helpful.  It worked!  I am now able to successfully create the monitor.
Reply all
Reply to author
Forward
0 new messages