fix: alert on bad response

Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
Ameya Shenoy 2021-05-04 20:33:34 +05:30
parent bdd4bd28e1
commit 9afcfa664f
Signed by: codingcoffee
GPG key ID: F7D58AAC5DACF8D3

6
app.py
View file

@ -28,6 +28,7 @@ def main():
message_header = "Atleast 1 new slot seems to have just opened up for vaccination.\n\n"
message_footer = "Visit [this link](https://selfregistration.cowin.gov.in/appointment) to book a slot for yourself."
bot = telegram.Bot(token=TELEGRAM_BOT_TOKEN)
logger.info('Initiating loop')
while True:
logger.info('Hitting CoWIN API')
@ -51,8 +52,11 @@ def main():
'fee_type': center.get('fee_type'),
}
available_center_list.append(curr)
else:
logger.info(response)
msg = "Cowin API is giving a bad response"
bot.sendMessage(chat_id=TELEGRAM_CHAT_ID, text=msg, parse_mode='markdown')
bot = telegram.Bot(token=TELEGRAM_BOT_TOKEN)
message_body = ''
if available_center_list:
for center in available_center_list: