-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.py
executable file
·40 lines (26 loc) · 999 Bytes
/
server.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
#!/usr/bin/env python
import logging
import connexion
from brapiresolver import BrapiResolver
def token_auth(token, required_scopes):
print("token_auth")
return {'user': 'admin'}
def bearer_auth(token):
print("bearer_auth")
return {'user': 'admin'}
def basic_auth(username, password, required_scopes=None):
print("basic_auth")
return {'user': 'admin'}
if __name__ == '__main__':
debug = False
if debug:
logging.basicConfig(format='%(asctime)-15s %(message)s', level=logging.DEBUG)
else:
logging.basicConfig(format='%(asctime)-15s %(message)s', level=logging.INFO)
app = connexion.FlaskApp(__name__, debug=debug)
app.add_api('brapi.yaml',
arguments={'title': 'TERRA-REF BRAPI'},
resolver=BrapiResolver('api'),
resolver_error=501)
# app.run(port=5000, host=None, server='flask', debug=debug, use_reloader=False)
app.run(port=5000, host=None, server='flask', debug=debug)