* Always encode forward slashes as `%2F` in query parameters
* Revert inclusion of "%"
This is expected to fail tests due to double escaping
* Update `urlencode`
---------
Co-authored-by: Tom Christie <tom@tomchristie.com>
* Replace quadratic algo in LineDecoder
Leading to enormous speedups when doing things such as
Response(...).iter_lines() as described on issue #2422
* Update httpx/_decoders.py
* Update _decoders.py
Handle text ending in `\r` more gracefully.
Return as much content as possible.
* Update test_decoders.py
* Update _decoders.py
* Update _decoders.py
* Update _decoders.py
* Update httpx/_decoders.py
Co-authored-by: cdeler <serj.krotov@gmail.com>
* Update _decoders.py
---------
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: cdeler <serj.krotov@gmail.com>
* Drop RawURL
* First pass at adding urlparse
* Update urlparse
* Add urlparse
* Add urlparse
* Unicode non-printables can be valid in IDNA hostnames
* Update _urlparse.py docstring
* Linting
* Trim away ununsed codepaths
* Tweaks for path validation depending on scheme and authority presence
* Minor cleanups
* Minor cleanups
* full_path -> raw_path, forr internal consistency
* Linting fixes
* Drop rfc3986 dependency
* Add test for #1833
* Linting
* Drop 'rfc3986' dependancy from README and docs homepage
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* 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>
* 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
* Use either brotli (recommended for CPython) or brotlicffi (Recommended for PyPy and others)
* Add comments in places where we switch behaviour depending on brotli/brotlicffi
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Fix test_json_without_specified_encoding_*_error tests on big endian
platforms. The tests wrongly assume that data encoded as "utf-32-be"
can not be decoded as "utf-32". This is true on little endian platforms
but on big endian platforms "utf-32" is equivalent to "utf-32-be".
To avoid the problem, explicitly decode as "utf-32-le", as this should
trigger the expected exception independently of platform's endianness.
* Make Request and Response picklable
* fixup! Make Request and Response picklable
* Apply suggestions from code review
* Apply suggestions from code review
* Update tests/models/test_requests.py
Co-authored-by: Tom Christie <tom@tomchristie.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>
* Allow tuple as input of query parameters.
In the documentation it is stated that params can be dict, string or two
tuples. This allows to used two tuples. Previously it was possible to
use only tuple inside a list.
* tests for two tuples
* use isinstance to check the type of query params
* change list|tuple to in Sequence
* update documentation
* fix typing
* Support iter_raw(chunk_size=...) and aiter_raw(chunk_size=...)
* Unit tests for ByteChunker
* Support iter_bytes(chunk_size=...)
* Add TextChunker
* Support iter_text(chunk_size=...)
* Fix merge with master
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Support header comparisons with dict or list.
* Add check for no headers item
* Fixup testcases affected by headers comparison using dict or list
* Update test_responses.py
Co-authored-by: Tom Christie <tom@tomchristie.com>