-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
33 lines (22 loc) · 752 Bytes
/
run.py
File metadata and controls
33 lines (22 loc) · 752 Bytes
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 python3
import logging
import sys
import connexion
from flask_cors import CORS
from google.cloud.logging.handlers.container_engine import ContainerEngineHandler
from api.encoder import JSONEncoder
root = logging.getLogger()
root.setLevel(logging.DEBUG)
root.addHandler(ContainerEngineHandler(sys.stdout))
app = connexion.App(__name__, specification_dir='./api/swagger/')
app.app.json_encoder = JSONEncoder
CORS(app.app)
app.add_api('swagger.yaml', arguments={'title': 'Aquila APIs'}, swagger_json=True)
def main():
import os
HOST = os.getenv('HOST', '0.0.0.0')
PORT = os.getenv('PORT', 8080)
DEBUG = os.getenv('DEBUG', False)
app.run(port=PORT, debug=DEBUG, host=HOST)
if __name__ =='__main__':
main()