-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelloworld_app.py
155 lines (133 loc) · 5.14 KB
/
helloworld_app.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# This is an auto-generated file - DO NOT EDIT!!!
from flask_cors import cross_origin
from typing import Optional
from pydantic import BaseModel
from pymacaron.endpoint import pymacaron_flask_endpoint
from pymacaron.log import pymlogger
log = pymlogger(__name__)
def load_endpoints(app=None, error_callback=None):
from pymacaron import apipool
from helloworld.api import do_hello as f_helloworld_api_do_hello
from helloworld.api import do_hello as f_helloworld_api_do_hello_via_requires_auth
from pymacaron.auth import requires_auth
f_helloworld_api_do_hello_via_requires_auth = requires_auth(f_helloworld_api_do_hello_via_requires_auth)
from helloworld.api import do_hello_with_inheritance as f_helloworld_api_do_hello_with_inheritance_via_requires_auth
from pymacaron.auth import requires_auth
f_helloworld_api_do_hello_with_inheritance_via_requires_auth = requires_auth(f_helloworld_api_do_hello_with_inheritance_via_requires_auth)
from helloworld.api import do_crash as f_helloworld_api_do_crash
from helloworld.api import do_async as f_helloworld_api_do_async
from helloworld.api import do_async_die as f_helloworld_api_do_async_die
@app.route("/hello", methods=["GET"])
@cross_origin(headers=["Content-Type", "Authorization"])
def endpoint_get__hello():
return pymacaron_flask_endpoint(
api_name="helloworld",
f=f_helloworld_api_do_hello,
path_args={
},
form_args={
},
body_model_name=None,
query_model=None,
produces="application/json",
result_models=[
apipool.helloworld.Hello,
],
error_callback=error_callback,
)
log.info("Binding [helloworld] GET /hello ==> helloworld.api.do_hello")
@app.route("/hello/with/auth", methods=["GET"])
@cross_origin(headers=["Content-Type", "Authorization"])
def endpoint_get__hello_with_auth():
return pymacaron_flask_endpoint(
api_name="helloworld",
f=f_helloworld_api_do_hello_via_requires_auth,
path_args={
},
form_args={
},
body_model_name=None,
query_model=None,
produces="application/json",
result_models=[
apipool.helloworld.Hello,
],
error_callback=error_callback,
)
log.info("Binding [helloworld] GET /hello/with/auth ==> helloworld.api.do_hello")
@app.route("/hello/with/inheritance", methods=["POST"])
@cross_origin(headers=["Content-Type", "Authorization"])
def endpoint_post__hello_with_inheritance():
return pymacaron_flask_endpoint(
api_name="helloworld",
f=f_helloworld_api_do_hello_with_inheritance_via_requires_auth,
path_args={
},
form_args={
},
body_model_name="Question",
query_model=None,
produces="application/json",
result_models=[
apipool.helloworld.Hello,
],
error_callback=error_callback,
)
log.info("Binding [helloworld] POST /hello/with/inheritance ==> helloworld.api.do_hello_with_inheritance")
@app.route("/die", methods=["GET"])
@cross_origin(headers=["Content-Type", "Authorization"])
def endpoint_get__die():
return pymacaron_flask_endpoint(
api_name="helloworld",
f=f_helloworld_api_do_crash,
path_args={
},
form_args={
},
body_model_name=None,
query_model=None,
produces="application/json",
result_models=[
apipool.helloworld.Hello,
],
error_callback=error_callback,
)
log.info("Binding [helloworld] GET /die ==> helloworld.api.do_crash")
@app.route("/async", methods=["GET"])
@cross_origin(headers=["Content-Type", "Authorization"])
def endpoint_get__async():
return pymacaron_flask_endpoint(
api_name="helloworld",
f=f_helloworld_api_do_async,
path_args={
},
form_args={
},
body_model_name=None,
query_model=None,
produces="application/json",
result_models=[
apipool.helloworld.Hello,
],
error_callback=error_callback,
)
log.info("Binding [helloworld] GET /async ==> helloworld.api.do_async")
@app.route("/asyncdie", methods=["GET"])
@cross_origin(headers=["Content-Type", "Authorization"])
def endpoint_get__asyncdie():
return pymacaron_flask_endpoint(
api_name="helloworld",
f=f_helloworld_api_do_async_die,
path_args={
},
form_args={
},
body_model_name=None,
query_model=None,
produces="application/json",
result_models=[
apipool.helloworld.Hello,
],
error_callback=error_callback,
)
log.info("Binding [helloworld] GET /asyncdie ==> helloworld.api.do_async_die")