Skip to content

Commit 5b6925d

Browse files
Covid Api with python
1 parent 68e7459 commit 5b6925d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Covid-API-With-Python

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import requests
2+
3+
state = 'Maharashtra'.lower()
4+
city = 'Mumbai'.lower()
5+
api_address = "https://api.covid19india.org/state_district_wise.json"
6+
json_data = requests.get(api_address).json()
7+
num=range(1,39)
8+
9+
for n in num:
10+
for state in num:
11+
if city == json_data[state]['districtData'][n].lower():
12+
formatted_json = json_data['state']['districtData'][n]['active']
13+
state+=1
14+
n+=1
15+
print(f"Active Case in {state} is {formatted_json}")
16+
17+
18+

0 commit comments

Comments
 (0)