Tom Christie
cd03f62b72
Stricter data typechecking
2024-03-01 14:52:30 +00:00
James Braza
2318fd822c
Enabling ruff C416 ( #3001 )
...
* Enabled C416 in ruff
* Ran ruff on all files
* Ran ruff format
* Update pyproject.toml
---------
Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-12-13 11:30:39 +00:00
Thomas Grainger
e27d1b8333
replace pytest-asyncio and pytest-trio with anyio ( #2512 )
...
* 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>
2023-01-02 12:53:30 +00:00
Tom Christie
a8dd079be7
Raise TypeError if content is passed a 'dict' instance. ( #2495 )
2022-12-11 19:12:08 +00:00
Tom Christie
71a1589928
Use httpx public API for 'test_content' tests ( #2494 )
2022-12-06 13:27:05 +00:00
Martijn Pieters
933551c519
Typing: enable disallow_untyped_calls ( #2479 )
...
* 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>
2022-12-02 10:47:42 +00:00
Martijn Pieters
2d37321842
Typing: enable warn_return_any ( #2477 )
2022-11-30 13:08:02 +00:00
Martijn Pieters
049afe5b25
Typing: enable disallow_incomplete_defs ( #2476 )
...
The only places mypy reports issues is in the test suite.
2022-11-30 09:04:54 +00:00
Adrian Garcia Badaracco
69e13cbc39
Remove and dissallow unused type ignores ( #2470 )
...
* Remove and dissallow unused type ignores
* add pragmas
* fix ignore
2022-11-29 16:55:45 +00:00
Adrian Garcia Badaracco
16e2830624
use # pragma: no cover instead of # pragma: nocover ( #2471 )
...
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-29 10:23:18 -06:00
Tom Christie
8752e2672c
Drop .read/.aread from SyncByteStream/AsyncByteStream ( #2407 )
2022-11-07 14:01:29 +00:00
Tom Christie
6f5865f860
Read upload files using read(CHUNK_SIZE) rather than iter(). ( #1948 )
...
* Cap upload chunk sizes
* Use '.read' for file streaming, where possible
* Direct iteration should not apply chunk sizes
2021-11-22 13:15:39 +00:00
Tom Christie
2129a9789a
Prefer Content-Length over Transfer-Encoding: chunked for content=<file-like> cases. ( #1619 )
...
* Add failing test case for 'content=io.BytesIO(...)'
* Refactor peek_filelike_length to return an Optional[int]
* Peek filelength on file-like objects when rendering 'content=...'
2021-04-30 10:40:42 +01:00
Tom Christie
397aad98fd
Escalate the distinction between data=... and content=... to be stricter ( #1573 )
2021-04-16 10:06:12 +01:00
Tom Christie
110ce85652
Stream interface ( #1550 )
...
* Add SyncByteStream, AsyncByteStream to interface
* request.stream and response.stream as httpx.SyncByteStream/httpx.AsyncByteStream
* Update httpx/_transports/base.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_transports/default.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Move response classes in transports to module level
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2021-04-13 13:14:04 +01:00
Tom Christie
c26425aa58
Handle data={"key": [None|int|float|bool]} cases. ( #1539 )
...
* Fix Content-Length for unicode file contents with multipart
* Handle bool and None cases for URLEncoded data
* Handle int, float, bool, and None for multipart or urlencoded data
* Update httpx/_utils.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2021-03-26 12:54:04 +00:00
Tom Christie
354c4cac1f
Refactor content streams ( #1296 )
...
* Refactor content_streams internally
* Tidy up multipart
* Use ByteStream annotation internally
2020-09-18 10:50:15 +01:00
Tom Christie
cee1fccaca
Use Streams API for both requests and responses. ( #648 )
...
* Internal ContentStreams API
2019-12-20 16:05:04 +00:00
Tom Christie
8d4f182500
Added RequestContent ( #636 )
...
* Request Content
* Added RequestContent interface
* Docstrings on 'encode(data, files, json)'
* Update httpx/content.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* can_rewind -> can_replay
2019-12-18 10:51:34 +00:00