I am trying to access Gmail using its API on Python. I want all the UNREAD messages , only from INBOX.
I can call either:
GMAIL.users().messages().list(userId='me',labelIds='INBOX').execute()
or:
GMAIL.users().messages().list(userId='me',labelIds='UNREAD').execute()
However, calling both the labelIdsdoesn't work. Can someone help with using both the labelIds simultaneously.
TIA
I want all the UNREAD messages , only from INBOX.
UNREAD and INBOX aren't really "labels". Try the q parameter instead like:
GMAIL.users().messages().list(userId='me', q='in:inbox is:unread').execute()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With