-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapp.py
34 lines (25 loc) · 1.09 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from linky import Linky
from flask import request
from flask import jsonify
app = Flask(__name__)
@app.route('/consumption/year')
def getConsumptionPerYear():
linky = Linky(request.args.get('login'),request.args.get('password'))
return jsonify(linky.getConsumptionPerYear())
@app.route('/consumption/month')
def getConsumptionPerMonth():
linky = Linky(request.args.get('login'),request.args.get('password'))
return jsonify(linky.getConsumptionPerMonth(request.args.get('start'), request.args.get('end')))
@app.route('/consumption/day')
def getConsumptionPerDay():
linky = Linky(request.args.get('login'),request.args.get('password'))
return jsonify(linky.getConsumptionPerDay(request.args.get('start'), request.args.get('end')))
@app.route('/consumption/hour')
def getConsumptionPerHour():
linky = Linky(request.args.get('login'),request.args.get('password'))
return jsonify(linky.getConsumptionPerHour(request.args.get('start'), request.args.get('end')))
if __name__ == '__main__':
app.run(debug=True)