Advertisement
Guest User

Untitled

a guest
May 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. x = jsonify(message="Hello World!", status_code=90210, status=404)
  2. print "x = %sn" % str(x))
  3. print "x.status_code = %sn" % str(x.status_code))
  4. print "x.status = %sn" % str(x.status))
  5. print "dir(x) = %sn" % str(dir(x))
  6.  
  7. x = <Response 82 bytes [200 OK]>
  8. x.status_code = 200
  9. x.status = 200 OK
  10. dir(x) = ['__call__', '__class__', '__delattr__', '__dict__', '__doc__', '__enter__', '__exit__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_ensure_sequence', '_get_mimetype_params', '_on_close', '_status', '_status_code', 'accept_ranges', 'add_etag', 'age', 'allow', 'autocorrect_location_header', 'automatically_set_content_length', 'cache_control', 'calculate_content_length', 'call_on_close', 'charset', 'close', 'content_encoding', 'content_language', 'content_length', 'content_location', 'content_md5', 'content_range', 'content_type', 'data', 'date', 'default_mimetype', 'default_status', 'delete_cookie', 'direct_passthrough', 'expires', 'force_type', 'freeze', 'from_app', 'get_app_iter', 'get_data', 'get_etag', 'get_wsgi_headers', 'get_wsgi_response', 'headers', 'implicit_sequence_conversion', 'is_sequence', 'is_streamed', 'iter_encoded', 'last_modified', 'location', 'make_conditional', 'make_sequence', 'mimetype', 'mimetype_params', 'response', 'retry_after', 'set_cookie', 'set_data', 'set_etag', 'status', 'status_code', 'stream', 'vary', 'www_authenticate']
  11.  
  12. >>> x.get_data()
  13. '{n "message": "Hello World!", n "status": 404, n "status_code": 90210n}'
  14. >>> x.headers
  15. Headers([('Content-Type', u'application/json'), ('Content-Length', u'74')])
  16.  
  17. x = jsonify(message="Hello World!", status_code=90210, status=404)
  18. x.status_code = 404
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement