Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd9f3c2

Browse files
Covid-19 Real Time notification (avinashkranjan#969)
1 parent 03d169d commit bd9f3c2

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from plyer import notification
2+
import requests
3+
from bs4 import BeautifulSoup
4+
import time
5+
from englisttohindi.englisttohindi import EngtoHindi
6+
7+
def notify_user(title, message):
8+
notification.notify(
9+
title = title,
10+
message = message,
11+
app_icon = "./Covid-19_Real-time_Notification/Notify_icon.ico" ,
12+
timeout = 5)
13+
14+
def getInfo(url):
15+
r = requests.get(url)
16+
return r.text
17+
18+
19+
if __name__ == '__main__':
20+
t = int(input("Enter interval in secs: "))
21+
li = list(map(str, input("Enter name of states: ").split(",")))
22+
states = []
23+
for i in li:
24+
states.append(i + " ( " + str(((EngtoHindi(i)).convert)) + " )")
25+
26+
while True:
27+
HtmlData = getInfo('https://www.medtalks.in/live-corona-counter-india')
28+
soup = BeautifulSoup(HtmlData, 'html.parser')
29+
30+
myData = ""
31+
for tr in soup.find('tbody').find_all('tr'):
32+
myData += tr.get_text()
33+
myData = myData[1:]
34+
35+
itemList = myData.split("\n\n")
36+
for item in itemList[:-2]:
37+
dataList = item.split('\n')
38+
39+
if dataList[0] in states:
40+
nTitle = 'Cases of Covid-19'
41+
nText = f"State: {dataList[0]}: Total: {dataList[1]}\n Active: {dataList[2]}\n Death: {dataList[3]}"
42+
notify_user(nTitle, nText)
43+
time.sleep(2)
44+
time.sleep(t)
58.2 KB
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# REAL TIME COVID-19 OUTBREAK NOTIFICATION
2+
3+
This is a notifier built with the use of BeautifulSoup, which will keep updating the user about the situation of covid in a particular state the user wants to know about after a particular interval of time.
4+
5+
# What is the use ?
6+
7+
In this time of crisis, it is needed to keep ourselves updated with the cases of covid for our own safety and benefit, and to get a better view of the situation.
8+
Everyone would like to have a system, that keeps them updated about the total cases, cured and deaths at an interval on its own. This script does exactly that for the user!
9+
10+
# How to Use :
11+
12+
Once the user starts the program, it will ask you about the state whose data you want to know, after it is entered, the notification system will do the work by itself and keep updating the user after an interval of an hour. The script will keep running in the background until the user exits it manually.
13+
14+
# Development Status
15+
16+
This script is at present complete. A future version may include a display of data of various states and also compare the new cases to cured cases, give updates on the vaccine distribution, etc.
17+
18+
# Developed by [Sayantani Saha](https://github.com/sayantani11)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Plyer
2+
requests
3+
bs4
4+
time
5+
englisttohindi

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /