Skip to content

Commit 70eb5a8

Browse files
authored
Merge pull request #207 from tanweeralii/tanweeralii
Added Simple Covid Notifier Script
2 parents 90d09e5 + 868bde5 commit 70eb5a8

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Simple Covid Notifier
2+
3+
A python script to update about the covid cases like Deaths, Recovered and Active Cases in India by using covid19api. It will update the cases every one hour.
4+
For more info:
5+
* [Covid API](https://api.covid19api.com/)
6+
7+
## Setup Guidelines
8+
9+
```bash
10+
git clone https://github.com/sanscript-tech/hacking-tools-scripts.git
11+
cd hacking-tools-scripts/Python/Simple_Covid_Notifier/
12+
sudo pip3 install -r requirements.txt
13+
sudo apt-get install python3-tk
14+
```
15+
- To run the script:
16+
17+
```bash
18+
sudo python3 main.py
19+
```

Python/Simple_Covid_Notifier/main.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import requests
2+
import json
3+
import tkinter as tk
4+
from tkinter import messagebox
5+
import time
6+
7+
while True:
8+
url="https://api.covid19api.com/total/country/india"
9+
response = requests.request("GET", url)
10+
parsed_data = json.loads(response.text)
11+
Active_cases = parsed_data[-1]["Active"]
12+
Recovered = parsed_data[-1]["Recovered"]
13+
Deaths = parsed_data[-1]["Deaths"]
14+
root = tk.Tk()
15+
root.withdraw()
16+
final = "Active Cases :" + str(Active_cases) + "\n" + "Recovered :" + str(Recovered) + "\n" + "Deaths :" + str(Deaths)
17+
messagebox.showwarning('Covid Update for India', final)
18+
time.sleep(3600)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
requests
2+
time
3+
json

0 commit comments

Comments
 (0)