-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.py
33 lines (25 loc) · 896 Bytes
/
api.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
#!flask/bin/python
from flask import Flask, jsonify
import os
app = Flask(__name__)
app.config.from_pyfile('config/api.cfg')
os.environ['QUERY_URL'] = app.config['QUERY_URL']
os.environ['UPDATE_URL'] = app.config['UPDATE_URL']
os.environ['UPDATE_EMAIL'] = app.config['UPDATE_EMAIL']
os.environ['UPDATE_PASS'] = app.config['UPDATE_PASS']
from routes.fisfeed import fisfeed
from routes.citations import citations
from routes.harvest import harvest
from routes.vocab import vocab
app.register_blueprint(fisfeed)
app.register_blueprint(citations)
app.register_blueprint(harvest)
app.register_blueprint(vocab)
from resources.errors import ValidationError, AliasError, RESTError
@app.errorhandler(RESTError)
def handle_rest_error(error):
response = jsonify(error.to_dict())
response.status_code = error.status_code
return response
if __name__ == '__main__':
app.run(host='0.0.0.0')