Advertisement
Guest User

bino/simple-rest

a guest
Aug 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1.     from flask import Flask
  2.     from flask import request,abort, Response, jsonify
  3.     import json
  4.     app = Flask(__name__)
  5.     @app.route('/', methods=['POST', 'GET'])
  6.     def index():
  7.         retDict={}
  8.         retDict['control']={}
  9.         retDict['control']['Cleartext-Password']=request.json['User-Password']['value'][0]
  10.         retDict['reply']={}
  11.         retDict['reply']['Reply-Message']='Helo From Rest'
  12.         resp = jsonify(retDict)
  13.         resp.status_code = 200
  14.         print 'My Response Data:', resp.data
  15.         print 'My Response Headers:', resp.headers
  16.         return resp
  17.     if __name__ == "__main__":
  18.         app.run(host= '0.0.0.0', debug=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement