Guest User

Untitled

a guest
Jan 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. def on_post(self, req, resp):
  2. response = dict()
  3. try:
  4. data = simplejson.load(req.stream.read().decode("utf-8"))
  5. logger.info(data)
  6. mapUrl = req.get_params("url", None)
  7. response['url'] = add_google_key(mapUrl)
  8. resp.status = falcon.HTTP_200
  9. resp.body = simplejson.dumps(response)
  10. except Exception, ex:
  11. response['error'] = "Error occured"
  12. resp.status = falcon.HTTP_400
  13. resp.body = simplejson.dumps(response)
  14. return resp
  15.  
  16. POST /add HTTP/1.1
  17. Host: 127.0.0.1:8000
  18. Content-Type: application/json
  19. Cache-Control: no-cache
  20.  
  21. {
  22. "url": "www.google.com"
  23. }
Add Comment
Please, Sign In to add comment