diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2015-10-02 13:06:31 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2015-10-02 13:06:31 -0400 |
| commit | d594f9e88961cd2dbf667ea264f4251f87f9cd2d (patch) | |
| tree | 69cc8126ad72329e7e4ada20c3b3ea3d6b814926 /main.py | |
| download | dashboard-d594f9e88961cd2dbf667ea264f4251f87f9cd2d.tar.gz | |
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +from flask import Flask, render_template +import requests +app = Flask(__name__) + +app.config.from_pyfile("config.cfg") +api_key = app.config["API_KEY"] +api_root = "https://api.forecast.io/forecast/" + + +@app.route('/weather/<latitude>/<longitude>') +def weather(latitude, longitude): + url = api_root + api_key + "/" + latitude + "," + longitude + r = requests.get(url, params={"exclude": "alerts", "units": "ca"}) + return r.text + + +@app.route('/') +def main(): + return render_template("index.html") + +if __name__ == '__main__': + app.run() |
