Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. from flask import Flask, request
  2. import json
  3. app = Flask(__name__)
  4.  
  5. @app.route('/slackEndpoint/', methods=['POST','GET'])
  6. def refresh():
  7. JSONResponse = request.get_json()
  8.  
  9. print(json.loads(request.form["payload"]))
  10.  
  11. #Get single values by inputing the key as shown below.
  12. #JSONResponse.get('state')
  13.  
  14. #Get values inside an array doing the following
  15. #JSONResponse.get('submission').get('comment')
  16. '''
  17. params = {
  18. 'thing1': JSONResponse.get('state'),
  19. 'thing2': JSONResponse.get('token')
  20. }
  21. '''
  22. #return json.dumps(params)
  23. return "test"
  24.  
  25.  
  26. app.run(host='0.0.0.0', port=80, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement