Coronavirus Cases Notifier

How to create Coronavirus Cases Notifier using python

Coronavirus outbreak situation is getting worse day by day, and there is no positive news on vaccine or cure yet. There are currently 6,586,150 cases worldwide registered and over 388,000 deaths. The outbreak originated from Wuhan, China, however, the managed to prevent the spread in their country. Now the USA is suffering the most from the COVID-19 outbreak. There are 1,902,031 cases till now according to worldometers in the USA and over 109,100 deaths till now. Recently, George Floyd, an African-American, was brutally murdered because of racism. His death turned into a movement “Black Lives Matter” which then turned into a huge violent protest. So, it’s assumable that the situation of coronavirus is going to get worse in the USA. President Trump also terminated USA relations with the World Health Organization as trump claims, WHO didn’t inform the world about the virus on time.

Pakistan recently crossed China in the total number of Coronavirus cases and is now ranking 17 worldwide. The main reason for the spread in Pakistan is, you can have Coronavirus without even knowing that you have, showing no symptoms, but you end up spreading it without being aware of it. In order to stay aware of the total number of cases in the world, you can create a Coronavirus Cases Notifier using python, that way you will stay up to date with the cases.

How to create Coronavirus Cases Notifier using python

How To Create Coronavirus Cases Notifier Using Python


import requests
import time
from bs4 import BeautifulSoup
from plyer import notification
res=requests.get('https://www.worldometers.info/coronavirus/').text
soup=BeautifulSoup(res,'html.parser')
soup.encode('utf-8')
cases=soup.find("div",{"class":"maincounter-number"}).get_text().strip()
def notifyMe(title,message):
    notification.notify(title=title,
                       message=message,
                       timeout=5)
while True:
    notifyMe('Total cases',cases)
    time.sleep(10)

Use this code to create Coronavirus cases Notifier. After every 10 seconds, the notification will show up along with the updated number of total cases of Coronavirus worldwide.

Masab Farooque
Masab Farooque is a Tech Geek, Writer, and Founder at The Panther Tech. He is also a lead game developer at 10StaticStudios. When he is not writing, he is mostly playing video games