When I run the get_availability_by_district for let's say, for next 15 days, one query after the other, I get the below error and program crashes out.
File "cowin.py", line 33, in job
available_centers = cowin.get_availability_by_district(district_id, date.strftime("%d-%m-%Y"), min_age_limit)
File "/Users/sm/Library/Python/3.8/lib/python/site-packages/cowin_api/api.py", line 49, in get_availability_by_district
return self.get_availability_by_base(caller='district', areas=district_id,
File "/Users/sm/Library/Python/3.8/lib/python/site-packages/cowin_api/api.py", line 35, in get_availability_by_base
curr_result = filter_centers_by_age_limit(self._call_api(url),
File "/Users/sm/Library/Python/3.8/lib/python/site-packages/cowin_api/utils.py", line 11, in filter_centers_by_age_limit
original_centers = centers.get('centers')
AttributeError: 'HTTPError' object has no attribute 'get'
This is probably due to the server not returning any results (either because the server is busy, or several API calls have been made to the server recently).
PR #16 to has a potential solution for this.
As an adhoc solution, you can add retries with some delay to try and solve this.
When I run the get_availability_by_district for let's say, for next 15 days, one query after the other, I get the below error and program crashes out.
File "cowin.py", line 33, in job available_centers = cowin.get_availability_by_district(district_id, date.strftime("%d-%m-%Y"), min_age_limit) File "/Users/sm/Library/Python/3.8/lib/python/site-packages/cowin_api/api.py", line 49, in get_availability_by_district return self.get_availability_by_base(caller='district', areas=district_id, File "/Users/sm/Library/Python/3.8/lib/python/site-packages/cowin_api/api.py", line 35, in get_availability_by_base curr_result = filter_centers_by_age_limit(self._call_api(url), File "/Users/sm/Library/Python/3.8/lib/python/site-packages/cowin_api/utils.py", line 11, in filter_centers_by_age_limit original_centers = centers.get('centers') AttributeError: 'HTTPError' object has no attribute 'get'