Skip to content

Commit 063353b

Browse files
Merge pull request #844 from Gaurav1401/main
Covid CasesAPI
2 parents c2b9b29 + 476bdc9 commit 063353b

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed
16.7 KB
Loading
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Covid 19 Tracker
2+
3+
## AIM
4+
To show all kinds of updates reagrding covid 19 cases. ```The data gets updated after every 10 minutes```
5+
6+
## Purpose
7+
To get useful information regarding the records of covid 19 cases from [disease.sh](https://disease.sh/v3/covid-19/all) API, like:
8+
- Total Number of cases till now.
9+
- Total Number of cases today
10+
- Total Number of Deaths Today.
11+
- Total Active cases
12+
- Total Critical cases
13+
<br>
14+
and many more ...
15+
16+
## Short description of package/script
17+
Libraries used in this project are:<br>
18+
- ```requests```:- To get an API call from the website. <br>
19+
- ```json```:- To convert the json data that we got from API to python data.
20+
21+
## Workflow of the Project
22+
This project follows the following steps:<br>
23+
- Importing relevant libraries
24+
- Making an API call
25+
- Converting json data to python data
26+
- Accessing the python data to show the records.
27+
28+
## Setup Instructions
29+
In order to run this code in your system, one needs to make sure that relevant libraries are installed, use the following commands for installation:
30+
- ```pip install requests```<br>
31+
- ```pip install json```
32+
33+
## Outputs
34+
![Corona_Records](Images/covid.png)
35+
36+
## Author
37+
[Gaurav Kumar](https://github.com/Gaurav1401)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import requests
2+
import json # to read the json data
3+
4+
# API link:- https://disease.sh/v3/covid-19/all
5+
6+
response = requests.get('https://disease.sh/v3/covid-19/all')
7+
# print(response.status_code) #To check whether API call is successful(200) or not(404)
8+
# print(response.text) # To access all the content of the website
9+
# print(response.url) # url of the website to which we made our API call
10+
11+
print("\n\n")
12+
python_data = json.loads(response.text) # Converting json data to python data
13+
# print(type(python_data))
14+
for key in python_data.keys():
15+
print(f'{key} : {python_data[key]}') # Calling the whole data from the API
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Libraries: "requests", "json"
2+
Browser like Mozilla Firefox

0 commit comments

Comments
 (0)