-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (29 loc) · 943 Bytes
/
app.py
File metadata and controls
38 lines (29 loc) · 943 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
34
35
36
37
38
#!/usr/bin/env python
# Copyright (c) 2022 SMHI, Swedish Meteorological and Hydrological Institute.
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
"""
TEMPLATE: https://github.com/sharksmhi/microservice_template
Examples:
get: http://localhost:5000/translation
get: http://localhost:5000/translation?attribute=WINDIR
get: http://localhost:5000/translation?attribute=PROJ&value=BLK
"""
import connexion
from translation import CodeHandler
handler = CodeHandler()
def get_info(*args, attribute=None, value=None, **kwargs):
"""Return dictionary.
Response with code/name related information based on arguments.
"""
return handler.get_info(
attribute=attribute,
value=value
)
app = connexion.FlaskApp(
__name__,
specification_dir='./',
options={'swagger_url': '/'},
)
app.add_api('openapi.yaml')
if __name__ == "__main__":
app.run(port=5000)