Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This adds support for zstd decoding using the python package zstandard.
This is similar to how it is implemented in urllib3. I also chose the
optional installation option httpx[zstd] to mimic the same option in
urllib3.
zstd decoding is similar to brotli, but in benchmarks it is supposed to
be even faster. The zstd compression is described in RFC 8878.
See https://github.com/encode/httpx/discussions/1986
Co-authored-by: Kamil Monicz <kamil@monicz.dev>
* add missing type hints to __init__
https://peps.python.org/pep-0484/
* add info to changelog
* Update CHANGELOG.md
* Update CHANGELOG.md
---------
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
* fix type annotation for MockTransport
* add type ignore
* better type checks
* better type checks
* add pragma
---------
Co-authored-by: Tom Christie <tom@tomchristie.com>
* NetRCAuth class
* Add docs for httpx.NetRCAuth()
* Drop failing cross-domain test for NetRCAuth()
* Update tests
* Update httpx/_auth.py
* Add tests for netrc file with no password
* replace pytest-asyncio with anyio
* remove pytest-trio also
* Update setup.cfg
* use anyio.Lock in test_auth
Co-authored-by: Tom Christie <tom@tomchristie.com>
* Typing: enable disallow_untyped_calls
Only the test suite needed adjusting to add type hints.
* Update setup.cfg
Co-authored-by: Tom Christie <tom@tomchristie.com>
* reuse the digest auth challenge to avoid sending twice as many requests
* fix for digest testcase
* ran testing/linting scripts
* codereview changes, removed tomchristie username from all authentication tests
Co-authored-by: Philipp Reitter <p.reitter@accessio.at>
Co-authored-by: Tom Christie <tom@tomchristie.com>
* Typing: always fill in generic type parameters
Being explicit about the parameters helps find bugs and makes the library
easier to use for users.
- Tell mypy to disallow generics without parameter values
- Give all generic types parameters values
* fix things that aren't coming in from other commits
* lint
Co-authored-by: Martijn Pieters <mj@zopatista.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
* Add Response(..., default_encoding=...)
* Add tests for Response(..., default_encoding=...)
* Add Client(..., default_encoding=...)
* Switch default encoding to 'utf-8' instead of 'autodetect'
* Make charset_normalizer an optional dependancy, not a mandatory one.
* Documentation
* Use callable for default_encoding
* Update tests for new charset autodetection API
* Update docs for new charset autodetection API
* Update requirements
* Drop charset_normalizer from requirements
* Test case for clean stream closing on cancellations
* Test case for clean stream closing on cancellations
* Linting on tests
* responses should close on any BaseException
* Integrate with httpcore 0.14
* Fix pool timeout test
* Add request extensions to API
* Add certificate and connection info to client, using 'trace' extension
* Fix test_pool_timeout flakiness
* Switch default on allow_redirects to False
* allow_redirects -> follow_redirects
* Update follow_redirects default in top-level API
* Update docs on follow_redirects
* Switch event hooks to also run on redirects
* Bump coverage
* Add pragma: no cover, because sometime ya just gotta be pragmatic
* Update docs with note about response.read()
* Add a network pytest mark for tests that use the network
Sometimes it's useful to have the tests that use the network
marked so they can be skipped easily when we know the network
is not available.
This is useful for example on SUSE and openSUSE's build servers.
When building the httpx packages (actually, any package in the
distribution) the network is disabled so we can assure
reproducible builds (among other benefits). With this mark, it's
easier to skip tests that can not succeed.
* Add a better explanation for the network marker
Co-authored-by: Florimond Manca <15911462+florimondmanca@users.noreply.github.com>
Co-authored-by: Joe <nigelchiang@outlook.com>
Co-authored-by: Florimond Manca <15911462+florimondmanca@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
* Deprecate per-request cookies
* Update docs/compatibility.md
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Update httpx/_client.py
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Update compatibility.md
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Added httpx.BaseTransport and httpx.AsyncBaseTransport
* Test coverage and default transports to calling .close on __exit__
* BaseTransport documentation
* Use 'handle_request' for the transport API.
* Docs tweaks
* Docs tweaks
* Minor docstring tweak
* Transport API docs
* Drop 'Optional' on Transport API
* Docs tweaks
* Tweak CHANGELOG
* Drop erronous example.py
* Push httpcore exception wrapping out of client into transport (#1524)
* Push httpcore exception wrapping out of client into transport
* Include close/aclose extensions in docstring
* Comment about the request property on RequestError exceptions
* Extensions reason_phrase and http_version as bytes (#1526)
* Extensions reason_phrase and http_version as bytes
* Update BaseTransport docstring
* Neaten up our try...except structure for ensuring responses (#1525)
* Fix CHANGELOG typo
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Fix CHANGELOG typo
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* stream: Iterator[bytes] -> stream: Iterable[bytes]
* Use proper bytestream interfaces when calling into httpcore
* Grungy typing workaround due to httpcore using Iterator instead of Iterable in bytestream types
* Update docs/advanced.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Consistent typing imports across tranports
* Update docs/advanced.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Add keepalive_expiry to Limits config
* keepalive_expiry should be optional. In line with httpcore.
* HTTPTransport and AsyncHTTPTransport
* Update docs for httpx.HTTPTransport()
* Update type hints
* Fix docs typo
* Additional mount example
* Tweak context manager methods
* Add 'httpx.HTTPTransport(proxy=...)'
* Use explicit keyword arguments throughout httpx.HTTPTransport
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Add httpx.MockTransport
* Add docs on MockTransport
* Add pointer to RESPX
* Add note on pytest-httpx
* Tweak existing docs example to use 'httpx.MockTransport'
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>