-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
58 lines (37 loc) · 1.39 KB
/
app.py
File metadata and controls
58 lines (37 loc) · 1.39 KB
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
53
54
55
56
57
58
import logging
from flask import Flask, jsonify, render_template
import fastems
import schedule
app = Flask(__name__)
app.config.from_pyfile('config.py')
handler = logging.FileHandler(app.config['LOGGING_LOCATION'])
handler.setLevel(app.config['LOGGING_LEVEL'])
handler.setFormatter(logging.Formatter(app.config['LOGGING_FORMAT']))
app.logger.addHandler(handler)
@app.errorhandler(500)
@app.errorhandler(Exception)
def unhandled_exception(e):
app.logger.error('Unhandled Exception: %s', (e))
return str(e)
# return render_template('500.htm'), 500
@app.route('/')
def index():
return jsonify({'msg': "Welcome to the Fastems Bridge"})
@app.route('/gids')
def get_gids():
return jsonify(fastems.get_part_number_to_gid_dict())
@app.route('/schedule')
def get_orders_payload():
s = schedule.Schedule(app.config['SCHEDULE_CSV_PATH'])
return jsonify(s.get_all())
@app.route('/services')
def service_list():
services = fastems.services.__all__
services.sort()
return render_template('services.html', services=services)
@app.route('/services/<service>')
def service(service):
return render_template('wsdl.html', service=service, wsdl=Services.dump(service))
@app.route('/operations/<service>')
def operations(service):
return render_template('wsdl.html', service=service, wsdl=Services.operations(service))