]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add example of specifying HTTP versions (#337)
authorPaul (xobb) Chubatyy <xobb@citylance.biz>
Thu, 12 Sep 2019 20:39:22 +0000 (13:39 -0700)
committerFlorimond Manca <florimond.manca@gmail.com>
Thu, 12 Sep 2019 20:39:22 +0000 (22:39 +0200)
Closes #336

docs/advanced.md

index 20122f205e4221b2a67d78228f7e859c70e3332f..dba5128ded7d3d8cdb220b0244f51a1b46e45403 100644 (file)
@@ -70,6 +70,20 @@ make modifications before sending the request.
 <Response [200 OK]>
 ```
 
+## Specify the version of HTTP protocol
+
+One can set the version of HTTP protocol for the client in case you want to make the requests using specific version.
+
+For example:
+
+```python
+h11_client = httpx.Client(http_versions=["HTTP/1.1"])
+h11_response = h11_client.get("https://myserver.com")
+
+h2_client = httpx.Client(http_versions=["HTTP/2"])
+h2_response = h2_client.get("https://myserver.com")
+```
+
 ## .netrc Support
 
 HTTPX supports .netrc file. In `trust_env=True` cases, if auth parameter is