-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
52 lines (36 loc) · 1.07 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from flask import Flask, render_template, url_for
import requests
import json
import sys
import logging
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
# app._static_folder = ''
app.logger.addHandler(logging.StreamHandler(sys.stdout))
app.logger.setLevel(logging.ERROR)
@app.route('/')
def index():
r = requests.get('https://corona.lmao.ninja/v2/countries/kenya')
return render_template('index.html', stats=json.loads(r.text))
@app.route('/global')
def Global():
g = requests.get('https://corona.lmao.ninja/v2/all')
return render_template('global.html', globe=json.loads(g.text))
@app.route('/about')
def About():
return render_template('about.html')
@app.route('/contact')
def Contact():
return render_template('contact.html')
now = datetime.now()
now = datetime.utcnow()
@app.route('/offline.html')
def offline():
return app.send_static_file('offline.html')
@app.route('/sw.js')
def sw():
return app.send_static_file('sw.js')
if __name__ == "__main__":
app.run(debug=True)