Newb here trying to trash an email from inbox with GMail Python API. Here is what I have:
24 try:
25 service.users().messages().trash(userId='me', id='from:johndoe@umich.edu').execute()
26 print ("Message with id: %s deleted successfully", msg_id)
27 except errors.HttpError, error:
28 print ("An error occurred: %s." % error)
I can confirm I have several emails in the inbox from johndoe@umich.edu using web interface, but when I try to run the python script, I am getting:
Checking : <googleapiclient.discovery.Resource object at 0x7f04f2e93b50>
An error occurred: <HttpError 400 when requesting https://www.googleapis.com/gmail/v1/users/me/messages/from%3Ajohndoe%40umich.edu/trash?alt=json returned "Invalid id value">.
I take it, id='from:johndoe@umich.edu' is not a valid id value. My question is how do I represent this so it is a valid id value?
Thanks