@@ -53,12 +53,12 @@ With ``hyper`` installed, you can start making HTTP/2 requests. At this
5353stage, ``hyper `` can only be used with services that *definitely * support
5454HTTP/2. Before you begin, ensure that whichever service you're contacting
5555definitely supports HTTP/2. For the rest of these examples, we'll use
56- Twitter .
56+ http2bin.org, a HTTP/1.1 and HTTP/2 testing service .
5757
58- Begin by getting the Twitter homepage::
58+ Begin by getting the homepage::
5959
6060 >>> from hyper import HTTP20Connection
61- >>> c = HTTP20Connection('twitter.com:443 ')
61+ >>> c = HTTP20Connection('http2bin.org ')
6262 >>> c.request('GET', '/')
6363 1
6464 >>> resp = c.getresponse()
@@ -75,15 +75,16 @@ come back to it.
7575Once you've got the data, things continue to behave exactly like
7676``http.client ``::
7777
78- >>> resp.getheader('content-encoding ')
79- 'deflate '
78+ >>> resp.getheader('content-type ')
79+ 'text/html; charset=utf-8 '
8080 >>> resp.getheaders()
81- [('x-xss-protection ', '1; mode=block ')...
81+ [('server ', 'h2o/1.0.2-alpha1 ')...
8282 >>> resp.status
8383 200
8484
85- We know that Twitter has compressed the response body. ``hyper `` will
86- automatically decompress that body for you, no input required::
85+ If http2bin had compressed the response body. ``hyper `` would automatically
86+ decompress that body for you, no input required. This means you can always get
87+ the body by simply reading it::
8788
8889 >>> body = resp.read()
8990 b'<!DOCTYPE html>\n<!--[if IE 8]><html clas ....
@@ -100,10 +101,10 @@ the response from any of them, and switch between them using their stream IDs.
100101For example::
101102
102103 >>> from hyper import HTTP20Connection
103- >>> c = HTTP20Connection('twitter.com:443 ')
104- >>> first = c.request('GET', '/')
105- >>> second = c.request('GET ', '/lukasaoz ')
106- >>> third = c.request('GET', '/about ')
104+ >>> c = HTTP20Connection('http2bin.org ')
105+ >>> first = c.request('GET', '/get ')
106+ >>> second = c.request('POST ', '/post', data='key=value ')
107+ >>> third = c.request('GET', '/ip ')
107108 >>> second_response = c.getresponse(second)
108109 >>> first_response = c.getresponse(first)
109110 >>> third_response = c.getresponse(third)
@@ -124,8 +125,8 @@ HTTP/2. Once you've worked that out, you can get started straight away::
124125 >>> import requests
125126 >>> from hyper.contrib import HTTP20Adapter
126127 >>> s = requests.Session()
127- >>> s.mount('https://twitter.com ', HTTP20Adapter())
128- >>> r = s.get('https://twitter.com ')
128+ >>> s.mount('https://http2bin.org ', HTTP20Adapter())
129+ >>> r = s.get('https://http2bin.org/get ')
129130 >>> print(r.status_code)
130131 200
131132
0 commit comments