@@ -99,3 +99,35 @@ For example::
9999 >>> third_response = c.getresponse(third)
100100
101101``hyper `` will ensure that each response is matched to the correct request.
102+
103+ Requests Integration
104+ --------------------
105+
106+ Do you like `requests `_? Of course you do, everyone does! It's a shame that
107+ requests doesn't support HTTP/2.0 though. To rectify that oversight, ``hyper ``
108+ provides a transport adapter that can be plugged directly into Requests, giving
109+ it instant HTTP/2.0 support.
110+
111+ All you have to do is identify a host that you'd like to communicate with over
112+ HTTP/2.0. Once you've worked that out, you can get started straight away::
113+
114+ >>> import requests
115+ >>> from hyper.contrib import HTTP20Adapter
116+ >>> s = requests.Session()
117+ >>> s.mount('https://twitter.com', HTTP20Adapter())
118+ >>> r = s.get('https://twitter.com')
119+ >>> print(r.status_code)
120+ 200
121+
122+ This transport adapter is subject to all of the limitations that apply to
123+ ``hyper ``, and provides all of the goodness of requests.
124+
125+ A quick warning: some hosts will redirect to new hostnames, which may redirect
126+ you away from HTTP/2.0. Make sure you install the adapter for all the hostnames
127+ you're interested in::
128+
129+ >>> a = HTTP20Adapter()
130+ >>> s.mount('https://twitter.com', a)
131+ >>> s.mount('https://www.twitter.com', a)
132+
133+ .. _requests : http://python-requests.org/
0 commit comments