0

unread_msgs = GMAIL.users().messages().list(userId='me',labelIds=[label_id_one, label_id_two]).execute()

We get a dictonary. Now reading values for the key 'messages'

mssg_list = unread_msgs['messages']

while using gmail api in above code i get

Traceback (most recent call last): File "c:\Users\MyHP\Desktop\New folder\gmail_read.py", line 53, in mssg_list = unread_msgs['messages'] KeyError: 'messages'

  • Can you post the hierarchy of the response - the whole response sample? Also indicate which value you're trying to fetch. While you're at it, check this [SO post](https://stackoverflow.com/questions/16877422/whats-the-best-way-to-parse-a-json-response-from-the-requests-library). – noogui Jul 20 '18 at 11:08
  • i solved that error. ty – Shyam Kanani Jul 21 '18 at 13:01

0 Answers0