#!/usr/bin/evn python3
# -*- coding: utf-8 -*-
import httpx
import requests
In general, both the module are similar, Here, I just make a simple comparison on what are the differences between Python HTTPX and Requests module.
Requests | HTTPX | |
---|---|---|
Sessions | requests.Session() | httpx.Client() |
Async support |
Not supported |
httpx.AsyncClient() |
HTTP/2 support |
Not supported | httpx.Client(http2=True) httpx.AsyncClient(http2=True) |
I have started moving over to HTTPX since Dec 2022.
Links: