more examples
authorKenneth Reitz <me@kennethreitz.com>
Thu, 7 Jun 2012 01:09:19 +0000 (03:09 +0200)
committerKenneth Reitz <me@kennethreitz.com>
Thu, 7 Jun 2012 01:09:19 +0000 (03:09 +0200)
#657

docs/index.rst

index a3c98bc..ccd5734 100644 (file)
@@ -18,15 +18,19 @@ Things shouldn’t be this way. Not in Python.
 
 ::
 
-    >>> r = requests.get('https://api.github.com', auth=('user', 'pass'))
+    >>> r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
     >>> r.status_code
-    204
+    200
     >>> r.headers['content-type']
-    'application/json'
+    'application/json; charset=utf8'
+    >>> r.encoding
+    'utf-8'
     >>> r.text
-    ...
+    u'{"type":"User"...'
+    >>> r.json
+    {u'private_gists': 419, u'total_private_repos': 77, ...}
 
-See `the same code, without Requests <https://gist.github.com/973705>`_.
+See `similar code, without Requests <https://gist.github.com/973705>`_.
 
 Requests takes all of the work out of Python HTTP/1.1 — making your integration with web services seamless. There's no need to manually add query strings to your URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100%  automatic, powered by `urllib3 <https://github.com/shazow/urllib3>`_, which is embedded within Requests.