Update count.py
Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
parent
56626047c5
commit
a71ee6414a
1 changed files with 8 additions and 9 deletions
|
@ -15,12 +15,11 @@ CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
|
|||
|
||||
if not os.path.isfile(CREDENTIALS_PATH):
|
||||
print(0)
|
||||
sys.exit()
|
||||
|
||||
try:
|
||||
else:
|
||||
try:
|
||||
gmail = discovery.build(
|
||||
'gmail', 'v1', credentials=file.Storage(CREDENTIALS_PATH).get())
|
||||
labels = gmail.users().labels().get(userId='me', id='INBOX').execute()
|
||||
print(labels['messagesUnread'])
|
||||
except Exception as e:
|
||||
except Exception as e:
|
||||
print(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue