def getGoogleData(self, request={}, service=None): currentuser = User.objects.get(username=request.user.username) service_user = GoogleUser.objects.get(neemi_user=currentuser) print "Service_user: "******"Client: ", client print "service_user.last_calendar_access: ", service_user.last_calendar_access print "service_user.last_email_access: ", service_user.last_email_access print "service_user.last_contacts_access: ", service_user.last_contacts_access if service == 'gcal': gcal = gcalData(client=client, user=service_user) gcal.getALLCalendarsMetadata() gcal.getALLCalendarsEvents() # update date that the calendar was last accessed service_user.last_calendar_access = datetime.datetime.now() service_user.save() if service == 'googleplus': gplus = gplusData(client=client, user=service_user) # get activities and comments #gplus.getActivities() gplus.getALLActivities() if service == 'gmail': gmail = gmailData(client=client, user=service_user) #gmail.getUnseenEmails() #gmail.printMailBoxes() gmail.getALLInbox() gmail.getALLSentEmails() #gmail.getALLMail() # update date that the email was last accessed service_user.last_email_access = datetime.date.today() service_user.save() print "DONE collecting emails" if service == 'googlecontacts': gcontacts = gcontactsData(client=client, user=service_user) if (service_user.last_contacts_access == None): print "List all contacts: " gcontacts.ListAllContacts() else: print "List contacts updated since ", service_user.last_contacts_access gcontacts.ListContactsUpdatedSince() service_user.last_contacts_access = str(datetime.date.today()) service_user.save()
def getGoogleData(self, request={}, service=None): currentuser = User.objects.get(username=request.user.username) service_user = GoogleUser.objects.get(neemi_user=currentuser) print "Service_user: "******"Client: ", client print "service_user.last_calendar_access: ", service_user.last_calendar_access print "service_user.last_email_access: ", service_user.last_email_access print "service_user.last_contacts_access: ", service_user.last_contacts_access if service == 'gcal': gcal = gcalData(client=client, user=service_user) gcal.getALLCalendarsMetadata() gcal.getALLCalendarsEvents() # update date that the calendar was last accessed service_user.last_calendar_access = datetime.datetime.now() service_user.save() if service == 'googleplus': gplus = gplusData(client=client, user=service_user) # get authenticated user profile print 'Getting user profile...' gplus.getProfile(data_type='PROFILE', id='me') # get activities and comments print 'Getting activities...' gplus.getALLActivities() if service == 'gmail': gmail = gmailData(client=client, user=service_user) gmail.getGmailInbox() gmail.getGmailProfile() # update date that the email was last accessed service_user.last_email_access = datetime.date.today() service_user.save() if service == 'googlecontacts': gcontacts = gcontactsData(client=client, user=service_user) if (service_user.last_contacts_access == None): print "List all contacts: " gcontacts.ListAllContacts() else: print "List contacts updated since ", service_user.last_contacts_access gcontacts.ListContactsUpdatedSince() service_user.last_contacts_access = str(datetime.date.today()) service_user.save()