python - Query search in Gmail API doesn't work as web version -


i'm trying extract messages (gmail api) color of star. example, blue star.

def listmessagesmatchingquery(service, user_id='me', query=''):     try:         response = service.users().messages().list(userid=user_id,                                                    q=query).execute()         print(response)         messages = []         if 'messages' in response:             messages.extend(response['messages'])          while 'nextpagetoken' in response:             page_token = response['nextpagetoken']             response = service.users().messages().list(userid=user_id, q=query,                                                    pagetoken=page_token).execute()             messages.extend(response['messages'])         return messages      except errors.httperror error:         print('an error occurred: %s' % error)   print(listmessagesmatchingquery(gmail, query="has:blue-star")) 

and doesn't work web version, returns 0 emails. queries work (tried "from:...", "has:attachment", "has:drive", "before:...", "after:..." etc). can't find solution, need sort emails color of stars.

querying super stars in gmail api quite tricky. need change e.g. l:^ss_sb blue star, explained in blogpost.

has:yellow-star <=> l:^ss_sy has:blue-star <=> l:^ss_sb  has:red-star <=> l:^ss_sr  has:orange-star <=> l:^ss_so has:green-star <=> l:^ss_sg has:purple-star <=> l:^ss_sp has:red-bang <=> l:^ss_cr has:yellow-bang <=> l:^ss_cy has:blue-info <=> l:^ss_cb has:orange-guillemet <=> l:^ss_co has:green-check <=> l:^ss_cg has:purple-question <=> l:^ss_cp 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -