httpx 0.28.1


pip install httpx

  Latest version

Released: Dec 06, 2024


Meta
Author: Tom Christie
Requires Python: >=3.8

Classifiers

Development Status
  • 4 - Beta

Environment
  • Web Environment

Framework
  • AsyncIO
  • Trio

Intended Audience
  • Developers

License
  • OSI Approved :: BSD License

Operating System
  • OS Independent

Programming Language
  • Python :: 3
  • Python :: 3 :: Only
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12

Topic
  • Internet :: WWW/HTTP

HTTPX

HTTPX - A next-generation HTTP client for Python.

Test Suite Package version

HTTPX is a fully featured HTTP client library for Python 3. It includes an integrated command line client, has support for both HTTP/1.1 and HTTP/2, and provides both sync and async APIs.


Install HTTPX using pip:

$ pip install httpx

Now, let's get started:

>>> import httpx
>>> r = httpx.get('https://www.example.org/')
>>> r
<Response [200 OK]>
>>> r.status_code
200
>>> r.headers['content-type']
'text/html; charset=UTF-8'
>>> r.text
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'

Or, using the command-line client.

$ pip install 'httpx[cli]'  # The command line client is an optional dependency.

Which now allows us to use HTTPX directly from the command-line...

httpx --help

Sending a request...

httpx http://httpbin.org/json

Features

HTTPX builds on the well-established usability of requests, and gives you:

Plus all the standard features of requests...

  • International Domains and URLs
  • Keep-Alive & Connection Pooling
  • Sessions with Cookie Persistence
  • Browser-style SSL Verification
  • Basic/Digest Authentication
  • Elegant Key/Value Cookies
  • Automatic Decompression
  • Automatic Content Decoding
  • Unicode Response Bodies
  • Multipart File Uploads
  • HTTP(S) Proxy Support
  • Connection Timeouts
  • Streaming Downloads
  • .netrc Support
  • Chunked Requests

Installation

Install with pip:

$ pip install httpx

Or, to include the optional HTTP/2 support, use:

$ pip install httpx[http2]

HTTPX requires Python 3.8+.

Documentation

Project documentation is available at https://www.python-httpx.org/.

For a run-through of all the basics, head over to the QuickStart.

For more advanced topics, see the Advanced Usage section, the async support section, or the HTTP/2 section.

The Developer Interface provides a comprehensive API reference.

To find out about tools that integrate with HTTPX, see Third Party Packages.

Contribute

If you want to contribute with HTTPX check out the Contributing Guide to learn how to start.

Dependencies

The HTTPX project relies on these excellent libraries:

  • httpcore - The underlying transport implementation for httpx.
    • h11 - HTTP/1.1 support.
  • certifi - SSL certificates.
  • idna - Internationalized domain name support.
  • sniffio - Async library autodetection.

As well as these optional installs:

  • h2 - HTTP/2 support. (Optional, with httpx[http2])
  • socksio - SOCKS proxy support. (Optional, with httpx[socks])
  • rich - Rich terminal support. (Optional, with httpx[cli])
  • click - Command line client support. (Optional, with httpx[cli])
  • brotli or brotlicffi - Decoding for "brotli" compressed responses. (Optional, with httpx[brotli])
  • zstandard - Decoding for "zstd" compressed responses. (Optional, with httpx[zstd])

A huge amount of credit is due to requests for the API layout that much of this work follows, as well as to urllib3 for plenty of design inspiration around the lower-level networking details.


HTTPX is BSD licensed code.
Designed & crafted with care.

โ€” ๐Ÿฆ‹ โ€”

Release Information

Fixed

  • Reintroduced supposedly-private URLTypes shortcut. (#2673)

Full changelog

1.0.dev3 Sep 15, 2025
1.0.dev2 Aug 04, 2025
1.0.dev1 Jul 02, 2025
0.28.1 Dec 06, 2024
0.28.0 Nov 28, 2024
0.27.2 Aug 27, 2024
0.27.1 Aug 27, 2024
0.27.0 Feb 21, 2024
0.26.0 Dec 20, 2023
0.25.2 Nov 24, 2023
0.25.1 Nov 03, 2023
0.25.0 Sep 11, 2023
0.24.1 May 19, 2023
0.24.0 Apr 11, 2023
0.23.3 Jan 04, 2023
0.23.2 Jan 02, 2023
0.23.1 Nov 18, 2022
0.23.0 May 23, 2022
0.22.0 Jan 26, 2022
0.21.3 Jan 06, 2022
0.21.2 Jan 05, 2022
0.21.1 Nov 16, 2021
0.21.0 Nov 15, 2021
0.20.0 Oct 13, 2021
0.19.0 Aug 19, 2021
0.18.2 Jun 17, 2021
0.18.1 Apr 29, 2021
0.18.0 Apr 27, 2021
0.17.1 Mar 15, 2021
0.17.0 Feb 28, 2021
0.16.1 Oct 08, 2020
0.16.0 Oct 06, 2020
0.15.5 Oct 01, 2020
0.15.4 Sep 25, 2020
0.15.3 Sep 24, 2020
0.15.2 Sep 23, 2020
0.15.1 Sep 23, 2020
0.15.0 Sep 22, 2020
0.14.3 Sep 02, 2020
0.14.2 Aug 24, 2020
0.14.1 Aug 11, 2020
0.14.0 Aug 07, 2020
0.13.3 May 29, 2020
0.13.2 May 27, 2020
0.13.1 May 22, 2020
0.13.0 May 22, 2020
0.13.0.dev2 May 12, 2020
0.13.0.dev1 May 06, 2020
0.13.dev0 Apr 30, 2020
0.12.1 Mar 19, 2020
0.12.0 Mar 09, 2020
0.11.1 Jan 17, 2020
0.11.0 Jan 09, 2020
0.10.1 Jan 01, 2020
0.10.0 Dec 29, 2019
0.9.5 Dec 20, 2019
0.9.4 Dec 13, 2019
0.9.3 Dec 07, 2019
0.9.2 Dec 07, 2019
0.9.1 Dec 06, 2019
0.9.0 Dec 06, 2019
0.8.0 Nov 27, 2019
0.7.8 Nov 19, 2019
0.7.7 Nov 15, 2019
0.7.6 Nov 02, 2019
0.7.5 Oct 10, 2019
0.7.4 Sep 26, 2019
0.7.3 Sep 20, 2019
0.7.2 Aug 29, 2019
0.7.1 Aug 18, 2019
0.7.0 Aug 17, 2019
0.6.8 Jul 25, 2019
0.6.7 Jul 19, 2019

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
anyio
certifi
httpcore (==1.*)
idna