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
666cbbdfe8
Fix automatic .read() when Response instances are created with content=<str> ( #1324 )
2020-09-25 11:29:17 +01:00
Tom Christie
f932af9172
Version 0.15.0 ( #1301 )
...
* Version 0.15.0
* Update CHANGELOG.md
Co-authored-by: Jamie Hewland <jamie.hewland@hpe.com>
* Escalate deprecations into removals.
* Deprecate overly verbose timeout parameter names
* Fully deprecate max_keepalive in favour of explicit max_keepalive_connections
* Fully deprecate PoolLimits in favour of Limits
* Deprecate instantiating 'Timeout' without fully explicit values
* Include deprecation notes in changelog
* Use httpcore 0.11.x
Co-authored-by: Jamie Hewland <jamie.hewland@hpe.com>
2020-09-22 11:44:28 +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
f3c29416f1
Support Response(text=...), Response(html=...), Response(json=...) ( #1297 )
...
* Refactor content_streams internally
* Tidy up multipart
* Use ByteStream annotation internally
* Support Response(text=...), Response(html=...), Response(json=...)
* Add tests for Response(text=..., html=..., json=...)
2020-09-21 11:19:19 +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
d0fe113945
Drop chardet ( #1269 )
...
* Internal refactoring to swap auth/redirects ordering
* Drop chardet for charset detection
* Drop chardet in favour of simpler charset autodetection
* Revert unintentionally included changes
* Update test case
* Refactor to prefer different decoding style
* Update text decoding docs/docstrings
* Resolve typo
* Update docs/quickstart.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-09-15 11:20:19 +01:00
Tom Christie
5ee6135256
Support Response(content=<bytes iterator>) ( #1265 )
...
* Support Response(content=<bytes iterator>)
* Update test for merged master
2020-09-11 10:28:18 +01:00
cdeler
ed16eb3a3d
Add progress to streaming download ( #1268 )
...
* Added last_raw_chunk_size to the Response object (#1208 )
* Added example with progress bar (#1208 )
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Apply suggestions from code review
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* PR review
Changed last_raw_chunk_size to num_bytes_downloaded ;
Edited the example according to documentaion
* Update docs/advanced.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update docs/advanced.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update docs/advanced.md
* Update docs/advanced.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-09-10 12:16:00 +03:00
cdeler
15187e7c21
Fixed test_multiple_set_cookie ( #1270 )
...
* Fixed test_multiple_set_cookie
* Update test_cookies.py
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-09-09 10:01:39 +01:00
Tom Christie
a783fe5758
Drop request.timer attribute. ( #1249 )
...
* Drop request.timer attribute
* Response(..., elapsed_func=...)
2020-09-07 09:06:14 +01:00
Tyler Wozniak
42c66863d0
Raise a proper type error on invalid URL type ( #1259 )
...
* Added test for expected URL class behavior
* Updated URL class, tests pass
* Updated to include type in error message
2020-09-04 23:14:59 +02:00
Tom Christie
19b863af40
Header refinements ( #1248 )
...
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-09-02 21:32:48 +01:00
Tom Christie
de502a44c6
Drop Response(..., request=...) style in test cases. ( #1243 )
...
* Drop Response(..., request=...) style in test cases except where required
* Lowercase variable name
2020-09-02 10:10:32 +01:00
tbascoul
e0b4528b17
Make the response's request parameter optional ( #1238 )
...
* Make the response's request parameter optional
* Fix _models coverage
* Move DecodingError in _models
* Update httpx/_models.py
* Update _models.py
* Update test_responses.py
* Update test_responses.py
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-09-01 15:14:57 +01:00
Florimond Manca
f5c27ec7f4
Use and pin black 20 ( #1229 )
2020-08-27 14:57:53 +01:00
Tom Christie
28c72050e0
Better test case consistency. Prefer import httpx and httpx.Client. ( #1222 )
...
* Prefer httpx.Client over httpx.AsyncClient in test cases, unless required.
* Prefer httpx.Client in test_headers
* Consistent httpx imports and httpx.Client usage
* Use 'import httpx' consistently in tests. Prefer httpx.Client.
2020-08-26 14:10:23 +01:00
cdeler
6e6ece66c6
Made cookies construct-able from a list of tuples ( #1211 )
...
* Added test which checks that cookie might be built from a list of tuples (#1209 )
* Made cookies constructable from a list of tuples (#1209 )
2020-08-24 10:44:48 +01:00
Tom Christie
655773e1c1
Handle URL quoting username and password components. ( #1159 )
...
* Handle URL quoting username and password components
* Tweak userinfo quoting
2020-08-11 17:18:12 +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
Joe
45de714592
Map rfc3986 exceptions ( #1163 )
...
* Map rfc3896 exceptions
2020-08-11 09:44:56 +01:00
Tom Christie
4cf74bc405
Fix behaviour with multiple Set-Cookie headers ( #1156 )
2020-08-10 14:53:51 +01:00
Tom Christie
e5f87434a5
Use get_list consistently ( #1119 )
...
* Use get_list consistently
* Ensure DeprecationWarning on getlist vs. get_list
2020-08-02 11:33:50 +01:00
Florimond Manca
a9284214e2
Make Headers.keys(), Headers.values() and Headers.items() return set-like views ( #1114 )
2020-08-01 20:15:15 +02:00
Tom Christie
2ba9c1ed90
Consistent multidict methods ( #1089 )
...
* Consistent multidict methods
* Consistent multidict methods and behaviour
* Update httpx/_models.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_models.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-31 11:46:35 +01: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
247ee0dc49
Drop private Origin model ( #1070 )
...
* Drop private Origin model
* Drop Origin from docs
* Update tests/test_utils.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Drop full_path test
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-23 09:54:45 +01:00
Tom Christie
8ed7e52a37
Drop fullpath setter ( #1069 )
2020-07-23 09:43:11 +01:00
Tom Christie
ff93a011a4
Support QueryParams(None) ( #1060 )
2020-07-16 11:16:29 +01:00
Josep Cugat
620b0670db
Increase test coverage - take 2 ( #1012 )
...
* Fix HttpError -> HTTPError typo
* Increased test coverage
* Increase coverage threshold
* Reuse sync/async transport code in test_auth.py
* Removed close_client check inside StreamContextManager
It's never set as True when used in async
* Reuse sync/async transport code in test_redirects.py
2020-06-02 10:24:45 +01:00
Josep Cugat
8c84210555
Increased test coverage & cleanup ( #1003 )
...
* Remove unused/untested headers copy() method
Last usage was removed in #804
* Remove unused premature_close server endpoint
Last usage was removed in #804
* Increased test coverage
* Revert removal of headers copy() method
Documented and added tests for it.
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-05-30 23:22:03 +02: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
Florimond Manca
82dc6f32f8
Switch to private module names ( #785 )
...
* Rename modules
* Update names in package
* Fix tests
* Review docs
2020-01-28 14:34:43 +00: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
Andrés Álvarez
2b92a78c41
Drop Origin from public API ( #688 )
...
- Drop the url.origin property.
- Drop Origin from the top-level export.
- Use origin = Origin(url) in our internal usage, rather than
url.origin.
Closes #656
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-01-07 10:39:47 +00:00
Tom Christie
11e7604d1a
Sync streaming interface on responses ( #695 )
...
* Sync streaming interface on responses
* Fix test case
* Test coverage for sync response APIs
* Address review comments
2020-01-02 12:56:11 +00:00
Tom Christie
b8394f1e00
Bump coverage ( #705 )
...
* Bump coverage
* Tests for iterative text decoding with 'aiter_text'
* nocover on xfail exception cases
* nocover API that is pending deprecation
* Tweak test to removed uncovered line
* Ingest request body in RedirectBodyUnavailable test case
2020-01-01 15:33:24 +00:00
Tom Christie
6a1ee0eb97
response.elapsed now reflects entire request/response time. ( #692 )
...
* Changed behaviour of elapsed on response
* Fixed api docs for Response elapsed
* Minor tweaks to 'request.elapsed'
* Response instantiated with content should have elapsed==0
* Fix elapsed time on immediately closed responses.
2019-12-29 16:56:18 +00:00
Florimond Manca
f9d18a8758
Rename 'read/close' to 'aread/aclose' on Response ( #674 )
...
* Switch to aread/aclose on responses
* Linting
Co-authored-by: Tom Christie <tom@tomchristie.com>
2019-12-29 15:14:53 +00:00
Florimond Manca
56c8edaf66
Make 'request' non-optional on responses ( #666 )
...
* Make 'request' non-optional on Response
* Lint
* Remove remaining mention to null request
2019-12-21 15:38:25 +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
74e5115b86
params argument on URL should merge, not replace. ( #653 )
2019-12-20 10:46:35 +00:00
Tom Christie
5ee512d803
Fix Host header and HSTS when the default port is explicitly included in URL ( #649 )
2019-12-20 10:25:42 +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
ec40d04382
Add aiter methods on response ( #610 )
2019-12-06 15:20:09 +00:00
Tom Christie
d15dc0b1f8
Tighten up top-level API to only expose public API ( #608 )
...
* Tighten up top-level API to only expose public API
* Leave HTTPProxyMode for backwards compat, raising warnings.
* Add missing import
2019-12-06 15:20:01 +00:00