This simple script will get the number of unread messages in the label
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.
After following the quickstart instructions, run the sample:
python -m SimpleHTTPServer 8000
And opening the web page:
|messagesUnread||integer||The number of unread messages with the label.|