-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
44 lines (29 loc) · 914 Bytes
/
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
import os
from flask import Flask, request
from timewatch import TimeWatchClient
app = Flask(__name__)
@app.route('/punch-in', methods=['POST'])
def punch_in():
body = request.get_json(force=True)
company = body['company']
employee_id = body['employeeId']
password = body['password']
client = TimeWatchClient(company, employee_id, password)
client.login()
client.punch_in()
return ':+1:'
@app.route('/punch-out', methods=['POST'])
def punch_out():
body = request.get_json(force=True)
company = body['company']
employee_id = body['employeeId']
password = body['password']
client = TimeWatchClient(company, employee_id, password)
client.login()
client.punch_out()
return ':+1:'
@app.errorhandler(404)
def page_not_found(error):
return '<html><head><title>...</title></head></html>'
if __name__ == '__main__':
app.run(debug=True)