pallupz / covid-vaccine-booking

This tool can be used to automate booking slots on Co-WIN Platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'centers' 'NoneType' object is not iterable

dbsheta opened this issue · comments

After running the script for some time, I get this error:

{'sessions': []}
'centers'
-e 
Traceback (most recent call last):
  File "/Users/username/Downloads/covid-vaccine-booking-main/src/utils.py", line 93, in check_calendar_by_district
    print(f"Centers available in {location['district_name']} from {start_date} as of {today.strftime('%Y-%m-%d %H:%M:%S')}: {len(resp['centers'])}")
KeyError: 'centers'
'NoneType' object is not iterable
Exiting Script

I think the you may have received an invalid response in that call. I will try to add an exception handling for this.

If you retry, that should work.

I added below at line 93 in utils.py and it's working fine since then.

if ('centers' not in resp):
    continue

I will make an equivalent change.

Not working even after adding:

if ('centers' not in resp):
    continue

change in two places:
image

image

Or use the latest code

Yes after the latest pull, It is working fine. Thanks!