bhattbhavesh91 / cowin-vaccination-slot-availability

Script to check the available slots for Covid-19 Vaccination Centers from CoWIN API in India.
Apache License 2.0
305 stars 273 forks source link

API not working in program #24

Closed pardeep3december closed 3 years ago

pardeep3december commented 3 years ago

Hi, I am using following code ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ import requests import datetime import json import pandas as pd

for state_code in range(1,40): print("State code: ", state_code) response = requests.get("https://cdn-api.co-vin.in/api/v2/admin/location/districts/{}".format(state_code))

json_data = json.loads(response.text)

print (response)
#for i in json_data["districts"]:
    #print(i["district_id"],'\t', i["district_name"])
#print("\n")

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Result is not coming . It is giving <Response [403]> . Whereas same api is working in web browser.

Snapshot attached. webbrowser coolab

bhattbhavesh91 commented 3 years ago

Doesn't work on Google Colab! Due to IP issues! Please read the readme file carefully!

pardeep3december commented 3 years ago

HI, Thanks for the update.

Just tried same code on my my laptop. But result is same.

Prog_windows

bhattbhavesh91 commented 3 years ago

disconnect the VPN! it only works with Indian IP addresses!

bhattbhavesh91 commented 3 years ago

and you need to add headers! please go through the app.py file!

pardeep3december commented 3 years ago

Thanks @bhattbhavesh91 I will try and update correspondingly

pardeep3december commented 3 years ago

Thanks @bhattbhavesh91 it's working