This simple script will get the number of unread messages in the label
https://github.com/jpierrevilleres/browser-samples/tree/master/gmail/quickstart
https://developers.google.com/gmail/api/quickstart/python
https://developers.google.com/api-client-library/python
Gmail API Browser Quickstart
Complete the steps described in the quickstart instructions, and in about five minutes you’ll have a simple browser application that makes requests to the Gmail API.
Run
After following the quickstart instructions, run the sample:
python -m SimpleHTTPServer 8000
And opening the web page:
https://developers.google.com/gmail/api/v1/reference/users/labels
https://developers.google.com/gmail/api/v1/reference/users/labels#methods
messagesUnread | integer | The number of unread messages with the label. |