Commit Graph

37 Commits

Author SHA1 Message Date
Elaina
8ecb86f0d7
Add test for request params behavior changes (#3364) (#3440)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2024-12-03 16:12:27 +00:00
BERRADA-Omar
9fd6f0ca66
Ensure JSON representation is compact. #3363 (#3367)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2024-10-28 14:40:22 +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
Marcelo Trylesinski
daec2bdcdb
Use ruff instead of flake8, autoflake and isort (#2648)
* Use ruff instead of flake8, autoflake and isort

* Update pyproject.toml
2023-04-05 12:37:10 +02: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
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
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
Hannes Ljungberg
2d571046e1
Make Request and Response picklable (#1579)
* 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>
2021-04-21 11:11:00 +01:00
Tom Christie
966550b342
For non-streaming cases, populate request.content automatically. (#1583)
* For non-streaming cases, populate request.content

* Linting
2021-04-19 11:13:45 +01:00
Tom Christie
397aad98fd
Escalate the distinction between data=... and content=... to be stricter (#1573) 2021-04-16 10:06:12 +01:00
Musale Martin
815ef94ed9
Support header comparisons with dict or list. (#1326)
* 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>
2020-09-25 12:28:34 +01:00
Tom Christie
8e4a8a1c73
Finesse URL properties (#1285)
* url.userinfo should be URL encoded bytes

* Neater copy_with implementation

* Finesse API around URL properties and copy_with

* Docstring for URL, and drop url.authority

* Support url.copy_with(raw_path=...)

* Docstrings on URL methods

* Tweak docstring
2020-09-21 11:35:25 +01:00
Tom Christie
fbb21fb1ae
Drop ContentStream (#1295)
* Drop ContentStream
2020-09-18 08:41:09 +01:00
Tom Christie
feb404f86b
Seperate content=... and data=... parameters (#1266)
* Seperate content=... and data=... parameters

* Update compatibility.md
2020-09-15 13:36:10 +01:00
Tom Christie
19b863af40
Header refinements (#1248)
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-09-02 21:32:48 +01:00
Joe
5b6d33e29c
Ignore transfer-encoding if content-length presents (#1170)
* Ignore transfer-encoding if content-length presents

Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-11 23:43:57 +08:00
Tom Christie
c089480260
URL.port becomes Optional[int] (#1080)
* URL.port becomes Optional[int], not int

* Minor _transport_for_url refactor

* Add docstring
2020-07-24 11:42:13 +01:00
Tom Christie
7e6e35160f
Drop URL(allow_relative=bool) (#1073)
* Drop URL(allow_relative=bool)

* Update httpx/_models.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>

* Linting

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-23 10:16:51 +01:00
Tom Christie
631ba97635
Revert "Add content-length header for empty bytestream (#866)" (#898)
This reverts commit 939f3ce7ce.
2020-04-08 13:15:22 +01:00
Dima Boger
939f3ce7ce
Add content-length header for empty bytestream (#866)
Also, fixed related tests
2020-03-28 16:05:06 +01:00
Tom Christie
ee37a762ef
Reintroduce sync API. (#735)
* BaseClient and AsyncClient

* Introduce 'httpx.Client'

* Top level API -> sync

* Top level API -> sync

* Add WSGI support, drop deprecated imports

* Wire up timeouts to urllib3

* Wire up pool_limits

* Add urllib3 proxy support

* Pull #734 into sync Client

* Update AsyncClient docstring

* Simpler WSGI implementation

* Set body=None when no content

* Wrap urllib3 connection/read exceptions
2020-01-08 12:31:50 +00:00
Tom Christie
12dd157fea
Public Auth API (#732)
* Public Auth API

* Minor docs tweak

* Request.aread and Request.content

* Support requires_request_body

* Update tests/models/test_requests.py

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-01-07 13:20:23 +00: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
Tom Christie
206c5372a6
Drop sync (#544)
Drop sync client
2019-11-27 10:43:42 +00:00
Tom Christie
2d09d5b36c
Renaming -> httpx (#129)
* Renaming -> httpx

* Renaming to httpx
2019-07-19 15:15:16 +01:00
Tom Christie
fe1f9ed119
Minor tweaks in line with requests behavior (#110) 2019-07-03 10:33:38 +01:00
Tom Christie
c9747aa357
http3 (#86)
* Start fleshing out documentation

* Docs work

* http3

* Update docs

* Include lowercase status codes, for requests compat

* Updating docs

* Docs tweaks
2019-06-12 15:02:16 +01:00
Tom Christie
0cbf3c7581
Sync or Async dispatch (#83)
* Support thread-pooled dispatch

* Add ConcurrencyBackend.run

* Initial work towards support byte-iterators on sync request data

* Test case for byte iterator content

* byte iterator support for RequestData

* Add BaseResponse

* Bridge sync/async data in SyncResponse

* Add BaseClient

* SyncResponse -> Response

* Tweaking type annotation

* Distinct classes for Request, AsyncRequest

* Tweak is_streaming, content in BaseRequest

* Stream handling moves to client

* Handle mediating to AsyncResponse from a standard sync Dispatcher class

* Working on thread-pooled dispatcher

* Support threaded dispatch, inc. streaming requests/responses

* Increase test coverage

* Coverage and tweaks

* Include Accept and User-Agent headers by default
2019-06-10 12:26:03 +01:00
Tom Christie
76bc6c6dea
Drop Host header for HTTP/2 (#82) 2019-05-28 14:39:57 +01:00
Yeray Diaz Diaz
2e9ab2e904 Include URL.__hash__ in test (#64)
* Include URL.__hash__ in test

* Add test for URLs being used in a set

Remove hash assertion on test requests

* Cleanup models.py

* Use membership test instead of equality to avoid ordering problems
2019-05-15 14:30:00 +01:00
Tom Christie
e91c69d2ad Support url-encoded data in requests 2019-05-08 14:59:41 +01:00
Tom Christie
19542f2c3c Request(content=...) -> Request(data=...) 2019-05-08 14:45:06 +01:00
Tom Christie
e99ffbd7ac Increase test coverage 2019-05-08 13:52:26 +01:00
Tom Christie
302fe93df9 Use rfc3986 for URL handling 2019-04-30 17:39:40 +01:00
Tom Christie
4255d41846 Prefer 'content' over 'body' 2019-04-30 15:08:24 +01:00
Tom Christie
dea4d42c6d Rejig test and tighten up models API 2019-04-30 13:52:37 +01:00