Kunal-Kumar-Sahoo / PyCowinAPI

A python package to check information about the near vaccination centers near the user's location
MIT License
7 stars 2 forks source link

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

Open apptechzies opened 3 years ago

apptechzies commented 3 years ago

I get following error when I use it on AWS server:

Traceback (most recent call last): File "cowinNotification.py", line 150, in jsonResponse = cowin.get_availability_by_pincode(str(key), listDates[x], 18) File "/home/ubuntu/.local/lib/python3.8/site-packages/cowin_api/api.py", line 55, in get_availability_by_pincode return self.get_availability_by_base(caller='pincode', areas=pin_code, File "/home/ubuntu/.local/lib/python3.8/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 "/home/ubuntu/.local/lib/python3.8/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'

Kunal-Kumar-Sahoo commented 3 years ago

Can you mail me the code? I ll see and reply to you asap

apptechzies commented 3 years ago

Hi,

Please find attached the code file.

Thanks.

On Sun, May 9, 2021 at 8:23 PM Kunal Kumar Sahoo @.***> wrote:

Can you mail me the code? I ll see and reply to you asap

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-835822259, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASPQFWT6J6KKK3KCDLPADQTTM2OXXANCNFSM44PFYCMA .

Kunal-Kumar-Sahoo commented 3 years ago

Did not find any code. Please mail it to my email id kunal.sahoo2003@gmail.com

Kunal-Kumar-Sahoo commented 3 years ago

Hey even tried to replicate your code and something is wrong that I cannot figure out currently. Just try to pass all the integer values with strings once. It worked out for me and I'll soon catch up to you with a perfect solution. Thanks for cooperation !!!

apptechzies commented 3 years ago

Can you share the example method call? I get error when I pass pincode as integer.

On Wed, May 12, 2021, 2:39 PM Kunal Kumar Sahoo @.***> wrote:

Hey even tried to replicate your code and something is wrong that I cannot figure out currently. Just try to pass all the integer values with strings once. It worked out for me and I'll soon catch up to you with a perfect solution. Thanks for cooperation !!!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-839605232, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASPQFWU36STCBOO3QVUYAPTTNJAS3ANCNFSM44PFYCMA .

Kunal-Kumar-Sahoo commented 3 years ago

Just pass pin code in the string format coz api accepts everything as string. Even in the code of package I have explicitely kept every parameter in string datatype due to this reason.

On Wed, 12 May 2021, 16:20 apptechzies, @.***> wrote:

Can you share the example method call? I get error when I pass pincode as integer.

On Wed, May 12, 2021, 2:39 PM Kunal Kumar Sahoo @.***> wrote:

Hey even tried to replicate your code and something is wrong that I cannot figure out currently. Just try to pass all the integer values with strings once. It worked out for me and I'll soon catch up to you with a perfect solution. Thanks for cooperation !!!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-839605232 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ASPQFWU36STCBOO3QVUYAPTTNJAS3ANCNFSM44PFYCMA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-839674095, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASEET4IO6XGIWKHHFD45HTDTNJMQXANCNFSM44PFYCMA .

apptechzies commented 3 years ago

Request:

jsonResponse = cowin.get_availability_by_pincode('110005','10-05-2021')

Error:

Traceback (most recent call last):

File "", line 1, in

File "/home/ubuntu/.local/lib/python3.8/site-packages/cowin_api/api.py", line 55, in get_availability_by_pincode

return self.get_availability_by_base(caller='pincode', areas=pin_code,

File "/home/ubuntu/.local/lib/python3.8/site-packages/cowin_api/api.py", line 41, in get_availability_by_base

results += curr_result['centers']

TypeError: 'HTTPError' object is not subscriptable

On Wed, May 12, 2021 at 4:25 PM Kunal Kumar Sahoo @.***> wrote:

Just pass pin code in the string format coz api accepts everything as string. Even in the code of package I have explicitely kept every parameter in string datatype due to this reason.

On Wed, 12 May 2021, 16:20 apptechzies, @.***> wrote:

Can you share the example method call? I get error when I pass pincode as integer.

On Wed, May 12, 2021, 2:39 PM Kunal Kumar Sahoo @.***> wrote:

Hey even tried to replicate your code and something is wrong that I cannot figure out currently. Just try to pass all the integer values with strings once. It worked out for me and I'll soon catch up to you with a perfect solution. Thanks for cooperation !!!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-839605232

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ASPQFWU36STCBOO3QVUYAPTTNJAS3ANCNFSM44PFYCMA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-839674095 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ASEET4IO6XGIWKHHFD45HTDTNJMQXANCNFSM44PFYCMA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kunal-Kumar-Sahoo/PyCowinAPI/issues/1#issuecomment-839676840, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASPQFWSIYCH2ALMCASAG3MDTNJNCNANCNFSM44PFYCMA .