Skip to content

Instantly share code, notes, and snippets.

@thomasjungblut
Last active May 6, 2021 12:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasjungblut/8cc5465882ffe92716adda385f841584 to your computer and use it in GitHub Desktop.
Save thomasjungblut/8cc5465882ffe92716adda385f841584 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
from time import sleep
import requests
from twilio.rest import Client
TWILIO_ACCOUNT_SID = "ACXXX"
TWILIO_AUTH_TOKEN = "XXX"
FROM = "+1XXXXX"
RECIPIENT = "+491XXXX"
def send_message(body: str):
print(body)
client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
message = client.messages.create(to=RECIPIENT, from_=FROM, body=body)
print("message sent: {}" % message.sid)
while True:
response = requests.get('https://www.doctolib.de/booking/ciz-berlin-berlin.json')
if response:
body = response.json()
practises = dict(
map(lambda place: (place['practice_ids'][0], (place['id'], place['formal_name'])), body['data']['places']))
agendas = body['data']['agendas']
for agenda in agendas:
if not agenda['booking_disabled']:
practise = practises[agenda['practice_id']]
send_message(
"available vacc at %s go to https://www.doctolib.de/institut/berlin/ciz-berlin-berlin?pid=%s" % (
practise[1], practise[0]))
else:
print("error while querying for data")
sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment