Skip to content

Instantly share code, notes, and snippets.

@dschep
Last active April 18, 2016 15:59
Show Gist options
  • Save dschep/b9c5b5529381d1737fc3 to your computer and use it in GitHub Desktop.
Save dschep/b9c5b5529381d1737fc3 to your computer and use it in GitHub Desktop.
Desktop notifications from Github using ntfy
#!/usr/bin/env python3
import json
import time
import requests
from ntfy.backends.default import notify
USER = 'YOUR USERNAME'
TOKEN = 'YOUR TOKEN'
API_URL = 'https://api.github.com'
while time.sleep(30) or True:
resp = requests.get(API_URL + '/notifications', auth=(USER, TOKEN),
verify=False)
for notification in resp.json():
notify(
notification['repository']['full_name'],
notification['subject']['title'],
icon='/usr/share/icons/Numix-Circle/48x48/apps/gitg.svg',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment