bhattbhavesh91/cowin-vaccination-slot-availability

API not working in program

pardeep3december opened this issue · 6 comments

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

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

HI,
Thanks for the update.

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

Prog_windows

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

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

Thanks @bhattbhavesh91
I will try and update correspondingly

Thanks @bhattbhavesh91 it's working