HTTP 2 request in python 2.7

For reference, as of 2019, another library supporting HTTP/2 is HTTPX.

HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.

This requires at least Python 3.6. However, at the time of writing in 2020, Python 2 is already EOL, so Python 3.6 should be okay for any users.


As others mentioned in the comments to the question the requests library does not support HTTP/2.

From the requests library documentation:

Requests allows you to send organic, grass-fed HTTP/1.1 requests, without the need for manual labor.

As of now the only HTTP/2 client for Python I know of is hyper, which quoting from the docs:

supports Python 3.4 and Python 2.7.9, and can speak HTTP/2 and HTTP/1.1

Tags:

Python

Http

Http2