forked from codehouseindia/Python-Programs
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCovid-API-With-Python
More file actions
Latest commit
18 lines (13 loc) · 470 Bytes
/
Copy pathCovid-API-With-Python
File metadata and controls
18 lines (13 loc) · 470 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import requests
state = 'Maharashtra'.lower()
city = 'Mumbai'.lower()
api_address = "https://api.covid19india.org/state_district_wise.json"
json_data = requests.get(api_address).json()
num=range(1,39)
for n in num:
for state in num:
if city == json_data[state]['districtData'][n].lower():
formatted_json = json_data['state']['districtData'][n]['active']
state+=1
n+=1
print(f"Active Case in {state} is {formatted_json}")