Update count.py

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-05-28 21:46:44 +02:00
parent 0b7f6502a9
commit 56626047c5
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python
import os
import sys
import pathlib
import subprocess
import time
@ -12,6 +13,10 @@ from httplib2 import ServerNotFoundError
DIR = os.path.dirname(os.path.realpath(__file__))
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
if not os.path.isfile(CREDENTIALS_PATH):
print(0)
sys.exit()
try:
gmail = discovery.build(
'gmail', 'v1', credentials=file.Storage(CREDENTIALS_PATH).get())