encode/httpx
Fork: 845 Star: 13301 (更新于 2024-11-21 02:17:07)
license: BSD-3-Clause
Language: Python .
A next generation HTTP client for Python. 🦋
最后发布版本: 0.27.2 ( 2024-08-27 20:52:29)
HTTPX - A next-generation HTTP client for Python.
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...
Sending a request...
Features
HTTPX builds on the well-established usability of requests
, and gives you:
- A broadly requests-compatible API.
- An integrated command-line client.
- HTTP/1.1 and HTTP/2 support.
- Standard synchronous interface, but with async support if you need it.
- Ability to make requests directly to WSGI applications or ASGI applications.
- Strict timeouts everywhere.
- Fully type annotated.
- 100% test coverage.
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 forhttpx
.-
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, withhttpx[http2]
) -
socksio
- SOCKS proxy support. (Optional, withhttpx[socks]
) -
rich
- Rich terminal support. (Optional, withhttpx[cli]
) -
click
- Command line client support. (Optional, withhttpx[cli]
) -
brotli
orbrotlicffi
- Decoding for "brotli" compressed responses. (Optional, withhttpx[brotli]
) -
zstandard
- Decoding for "zstd" compressed responses. (Optional, withhttpx[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.
— 🦋 —
最近版本更新:(数据更新于 2024-09-03 12:21:04)
2024-08-27 20:52:29 0.27.2
2024-08-27 19:27:46 0.27.1
2024-02-21 21:06:50 0.27.0
2023-12-20 19:01:16 0.26.0
2023-11-24 20:34:49 0.25.2
2023-11-03 21:25:25 0.25.1
2023-09-11 18:14:00 0.25.0
2023-05-18 19:05:02 0.24.1
2023-04-11 18:00:19 0.24.0
2023-01-04 17:39:59 0.23.3
主题(topics):
asyncio, http, python, trio
encode/httpx同语言 Python最近更新仓库
2024-11-24 20:32:32 xtekky/gpt4free
2024-11-24 01:08:40 jasoneri/ComicGUISpider
2024-11-23 07:15:18 comfyanonymous/ComfyUI
2024-11-23 02:05:08 hect0x7/JMComic-Crawler-Python
2024-11-22 19:26:55 ultralytics/ultralytics
2024-11-22 18:58:34 home-assistant/core