Fix some script to work offline

Signed-off-by: Severin Kaderli <severin@kaderli.dev>
This commit is contained in:
Severin Kaderli 2019-04-03 17:17:42 +02:00
parent a8d174269d
commit bad9590a7b
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
3 changed files with 12 additions and 8 deletions

View file

@ -1,7 +1,9 @@
image: ubuntu:latest
image: koalaman/shellcheck:latest
stages:
- Lint
before_script:
- apt-get update && apt-get install -y --no-install-recommends shellcheck
- shopt -s expand_aliases
- alias shellcheck="shellcheck -x --exclude=SC2034,SC1091,SC1090,SC2012"

View file

@ -12,8 +12,10 @@ from httplib2 import ServerNotFoundError
DIR = os.path.dirname(os.path.realpath(__file__))
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
gmail = discovery.build(
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'])
labels = gmail.users().labels().get(userId='me', id='INBOX').execute()
print(labels['messagesUnread'])
except Exception as e:
print(0)

View file

@ -12,6 +12,6 @@
# USAGE:
# ./update-count
UPDATES=$(pacman -Qu | wc -l)
AUR_UPDATES=$(yay -Qua --devel | wc -l)
AUR_UPDATES=$(yay -Qua --devel 2>&1 | wc -l)
echo "${UPDATES} / ${AUR_UPDATES}"