backtrackbaba / cowin

Python wrapper for CoWin API's
MIT License
42 stars 18 forks source link

AttributeError: 'HTTPError' object has no attribute 'get' #18

Closed muthyas closed 3 years ago

muthyas commented 3 years ago

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'

DragonWarrior15 commented 3 years ago
muthyas commented 3 years ago

Thanks, just added retries in my code. Seems like the server does timeout or unable to serve. I'm closing this issue for now.