Created
July 25, 2016 08:30
-
-
Save Lokaltog/5761338dfe4471fecfc72f7842722742 to your computer and use it in GitHub Desktop.
Tired of the Norwegian postal service (Posten/Bring) tagging shipments as "attempted delivered, nobody present/unknown address" without actually attempting to deliver the package? This script monitors the package tracking page and plays a siren sound/alert when the status changes. You can then call customer support and complain at +4721316234, i…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Tired of the Norwegian postal service (Posten/Bring) tagging shipments as | |
"attempted delivered, nobody present/unknown address" without actually | |
attempting to deliver the package? This script monitors the package tracking | |
page and plays a siren sound/alert when the status changes. You can then call | |
customer support and complain at +4721316234, if you're lucky they'll call the | |
delivery driver and tell him to return and actually deliver the package. | |
Requires requests and BeautifulSoup to run. | |
''' | |
import subprocess | |
import sys | |
import time | |
import requests | |
from bs4 import BeautifulSoup | |
while True: | |
r = requests.get('http://sporing.bring.no/sporing.html', params=dict(q=sys.argv[1])) | |
soup = BeautifulSoup(r.text, 'html.parser') | |
tooltip = soup.find_all('span', rel='tooltip')[0].string | |
if tooltip != 'Sendingen er lastet opp for utkjøring': | |
print('Fuck Posten/Bring!') | |
subprocess.run(['mpv', 'siren.mp3']) | |
break | |
sys.stdout.write('.') | |
sys.stdout.flush() | |
time.sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment