Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # I believe a better way to set cookies (and replacing the lines above) is:
  2.  
  3. status = '%s %s' % (response.status_code, status_text) # Still unused...
  4.  
  5. self.set_status(response.status_code)
  6. for h in response.items() :
  7. self.set_header(h[0], h[1])
  8.  
  9. # Set the cookies using the tornado function for that purpose.
  10. for cookie_key,cookie_value in response.cookies.iteritems() :
  11. self.set_cookie(cookie_key, cookie_value.value, **dict(cookie_value.iteritems()))
  12.  
  13. self.write(response.content)
  14. self.finish()
Add Comment
Please, Sign In to add comment