├── corona-data.json ├── __pycache__ ├── json.cpython-38.pyc └── jsons.cpython-38.pyc ├── slack_client.py ├── jsons.py └── index.py /corona-data.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /__pycache__/json.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksdkamesh99/covid-19/master/__pycache__/json.cpython-38.pyc -------------------------------------------------------------------------------- /__pycache__/jsons.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksdkamesh99/covid-19/master/__pycache__/jsons.cpython-38.pyc -------------------------------------------------------------------------------- /slack_client.py: -------------------------------------------------------------------------------- 1 | from slacker import Slacker 2 | def send(message): 3 | slack=Slacker('') 4 | slack.chat.post_message('#general',message) -------------------------------------------------------------------------------- /jsons.py: -------------------------------------------------------------------------------- 1 | import json 2 | FILE_NAME="corona-data.json" 3 | def save(x): 4 | with open(FILE_NAME, 'w') as f: 5 | json.dump(x, f) 6 | 7 | 8 | def load(): 9 | res = {} 10 | with open(FILE_NAME, 'r') as f: 11 | res = json.load(f) 12 | return res -------------------------------------------------------------------------------- /index.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | from slacker import Slacker 4 | import json 5 | import jsons as j 6 | 7 | extract_contents = lambda row: [x.text.replace('\n', '') for x in row] 8 | list=[] 9 | try: 10 | response=requests.get("https://www.mohfw.gov.in/").content 11 | soup = BeautifulSoup(response, 'html5lib') 12 | table=soup.findAll("tr") 13 | header=table[0].find_all('th') 14 | head=[] 15 | for i in header: 16 | head.append(i.text) 17 | 18 | list.append(head) 19 | 20 | for rows in table[1:]: 21 | u=[] 22 | tds=rows.find_all('td') 23 | for i in tds: 24 | u.append(i.text) 25 | list.append(u) 26 | past=j.load() 27 | print(past) 28 | 29 | 30 | 31 | except: 32 | print("Network Failure") 33 | 34 | 35 | --------------------------------------------------------------------------------