-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.py
166 lines (148 loc) · 3.27 KB
/
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
156
157
158
159
160
161
162
163
164
165
166
from flask import Flask, render_template, jsonify, request
from werkzeug.contrib.fixers import ProxyFix
from flaskmimerender import mimerender
app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app)
def render_html(**args):
return render_template('api.html', content=args)
render_json = jsonify
render_txt = lambda main: main
@app.route('/')
def index():
return render_template('index.html')
# Such wow
@app.route('/wow/<arg>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_wow(arg):
main = 'wow such %s.' % arg
content = {'main': main}
if request.method == 'GET':
return content
@app.route('/very/<arg>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_very(arg):
main = 'very %s. wow.' % arg
content={'main': main}
if request.method == 'GET':
return content
@app.route('/little/<arg>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_little(arg):
main = 'little %s. wow.' % arg
content={'main': main}
if request.method == 'GET':
return content
@app.route('/wat/<arg>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_wat(arg):
main = 'wat r u doin, %s.' % arg
content={'main': main}
if request.method == 'GET':
return content
@app.route('/omg/<arg>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_omg(arg):
main = 'omg such %s. wow.' % arg
content={'main': main}
if request.method == 'GET':
return content
# many variable
@app.route('/plz/<to>/<sender>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_plz(to, sender):
main = '%s plz' % to
content={'main': main, 'optional': sender }
if request.method == 'GET':
return content
@app.route('/plz/<to>')
@mimerender(
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_plz_no_sender(to):
main = "%s plz" % to
content = {'main': main}
if request.method == 'GET':
return content
@app.route('/thx/<to>/<sender>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_thx(to, sender):
main = 'thx %s' % to
content={'main': main, 'optional': sender}
if request.method == 'GET':
return content
@app.route('/thx/<to>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_anon_thx(to):
main = 'thx %s' % to
content={'main': main}
if request.method == 'GET':
return content
@app.route('/fuk/<to>/<sender>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_fuk(to, sender):
main = 'fuk u %s' % to
content = {'main': main, 'optional': sender }
if request.method == 'GET':
return content
@app.route('/fuk/<to>')
@mimerender (
default = 'html',
html = render_html,
json = render_json,
txt = render_txt
)
def show_anon_fuk(to):
main = 'fuk u %s' % to
content = {'main': main}
if request.method == 'GET':
return content
if __name__ == '__main__':
app.run(debug=True)