-
Notifications
You must be signed in to change notification settings - Fork 0
/
myflaskapp.py
36 lines (26 loc) · 1.01 KB
/
myflaskapp.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
from flask import Flask, request, Response
class MyResponse(Response):
default_mimetype = 'application/xml'
class MyFlask(Flask):
response_class = MyResponse
app = MyFlask(__name__)
@app.route('/')
def display():
return "Looks like it works!!"
@app.route('/alpha')
def alpha():
return "This is the aplha version !!"
@app.route('/number')
def input():
if 'src' in request.args and 'dst' in request.args :
return "The source of the request is {} and destination is {} ". format(request.args.get('src'), request.args.get('dst'))
@app.route('/beta')
def xml():
if 'src' in request.args and 'dst' in request.args and 'text' in request.args:
pass
src = request.args.get('src')
dst = request.args.get('dst')
text = request.args.get('text')
return '''<Response><Message callbackMethod="POST" callbackUrl="https://requestb.in/1md8ubo1" dst="{}" src="{}" type="sms">{}</Message></Response>'''.format(dst,src,text)
if __name__ == '__main__':
app.run(debug=True, port=3134)