]> git.ipfire.org Git - thirdparty/httpx.git/log
thirdparty/httpx.git
5 years agoDrop NBSP characters (#1389)
Tom Christie [Fri, 13 Nov 2020 12:38:03 +0000 (12:38 +0000)] 
Drop NBSP characters (#1389)

5 years agofix code example, in async.md (#1388)
podhmo [Wed, 11 Nov 2020 09:10:33 +0000 (18:10 +0900)] 
fix code example, in async.md (#1388)

5 years agoUpdate butterfly logo (#1382)
Tom Christie [Tue, 10 Nov 2020 10:16:07 +0000 (10:16 +0000)] 
Update butterfly logo (#1382)

5 years agoFix typo (#1386)
Kyungmin Lee [Sun, 8 Nov 2020 09:28:38 +0000 (18:28 +0900)] 
Fix typo (#1386)

* Fix typo

three greater-than signs -> three dots

* Fix typo

three greater-than signs -> three dots

* Fix typo

three greater-than signs -> three dots

5 years agoInclude invalid name/value when raising TypeError in DataField (#1368)
plotski [Thu, 5 Nov 2020 10:46:22 +0000 (10:46 +0000)] 
Include invalid name/value when raising TypeError in DataField (#1368)

5 years agoAdd new project to Third Party Packages (#1364)
Aber [Sat, 24 Oct 2020 21:32:51 +0000 (05:32 +0800)] 
Add new project to Third Party Packages (#1364)

* Add new project to Third Party Packages

* Fix typo

Co-authored-by: Josep Cugat <jcugat@gmail.com>
* Update third-party-packages.md

Co-authored-by: Josep Cugat <jcugat@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoDrop unecessary host="localhost" in https_server fixture to fix CI build (#1367)
Florimond Manca [Sat, 24 Oct 2020 21:25:31 +0000 (23:25 +0200)] 
Drop unecessary host="localhost" in https_server fixture to fix CI build (#1367)

5 years agoClose AsyncClient properly in test_async_next_request (#1361)
Tom Christie [Wed, 14 Oct 2020 06:38:53 +0000 (07:38 +0100)] 
Close AsyncClient properly in test_async_next_request (#1361)

5 years agoAdd raw_path to scope in ASGITransport (#1357)
Simon Willison [Fri, 9 Oct 2020 15:46:26 +0000 (08:46 -0700)] 
Add raw_path to scope in ASGITransport (#1357)

* Add raw_path to scope in ASGITransport, closes #1356

* Tweaked test

5 years agoVersion 0.16.1 (#1354) 0.16.1
Tom Christie [Thu, 8 Oct 2020 12:14:15 +0000 (13:14 +0100)] 
Version 0.16.1 (#1354)

5 years agoReplacing pytest-cov by coverage (#1353)
cdeler [Thu, 8 Oct 2020 12:05:30 +0000 (15:05 +0300)] 
Replacing pytest-cov by coverage (#1353)

5 years agoForce lowercase ASGI headers (#1351)
Tom Christie [Thu, 8 Oct 2020 11:04:10 +0000 (12:04 +0100)] 
Force lowercase ASGI headers (#1351)

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoCorrectly handle ipv6 addresses as a part of URL (#1349)
cdeler [Thu, 8 Oct 2020 08:37:13 +0000 (11:37 +0300)] 
Correctly handle ipv6 addresses as a part of URL (#1349)

* Correctly handle ipv6 addresses as a host

* Fixed typo

* Added an extra rfc reference

* Update tests/models/test_url.py

* Update tests/models/test_url.py

5 years agoVersion 0.16 (#1347) 0.16.0
Tom Christie [Tue, 6 Oct 2020 14:29:40 +0000 (15:29 +0100)] 
Version 0.16 (#1347)

5 years agoRun tests against Python 3.9 stable (#1348)
Michael K [Tue, 6 Oct 2020 13:57:30 +0000 (13:57 +0000)] 
Run tests against Python 3.9 stable (#1348)

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoPreserve header casing (#1338)
Tom Christie [Tue, 6 Oct 2020 13:57:10 +0000 (14:57 +0100)] 
Preserve header casing (#1338)

5 years agoDrop `.next()`/`.anext()` in favour of `response.next_request` (#1339)
Tom Christie [Tue, 6 Oct 2020 13:53:07 +0000 (14:53 +0100)] 
Drop `.next()`/`.anext()` in favour of `response.next_request` (#1339)

* Drop response.next()/response.anext() in favour of response.next_request

* Drop NotRedirectResponse

5 years agoTighten client closed-state behaviour (#1346)
Tom Christie [Tue, 6 Oct 2020 12:38:05 +0000 (13:38 +0100)] 
Tighten client closed-state behaviour (#1346)

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoRun tests against Python 3.9 and add trove classifier (#1342)
Michael K [Tue, 6 Oct 2020 12:12:52 +0000 (12:12 +0000)] 
Run tests against Python 3.9 and add trove classifier (#1342)

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoAdd VCR.py to third party packages doc. (#1345)
Jair Henrique [Mon, 5 Oct 2020 20:11:52 +0000 (17:11 -0300)] 
Add VCR.py to third party packages doc. (#1345)

5 years agoAllow covariants of __enter__, __aenter__, and @classmethod (#1336)
Changsheng [Fri, 2 Oct 2020 15:34:57 +0000 (11:34 -0400)] 
Allow covariants of __enter__, __aenter__, and @classmethod (#1336)

* Allow covariants of __enter__, __aenter__, and @classmethod

The problem we currently have is the return type of classes such as
Client does not allow covariants when subclassing or context manager.
In other words:

```python
class Base:
    def __enter__(self) -> Base:  # XXX
        return self

class Derived(Base):
    ...

with Derived() as derived:
   # The type of derived is Base but not Derived. It is WRONG
    ...
```

There are three approaches to improve type annotations.
1. Just do not type-annotate and let the type checker infer
   `return self`.
2. Use a generic type with a covariant bound
   `_AsyncClient = TypeVar('_AsyncClient', bound=AsyncClient)`
3. Use a generic type `T = TypeVar('T')` or `Self = TypeVar('Self')`

They have pros and cons.
1. It just works and is not friendly to developers as there is no type
   annotation at the first sight. A developer has to reveal its type via
   a type checker. Aslo, documentation tools that rely on type
   annotations lack the type. I haven't found any python docuementation
   tools that rely on type inference to infer `return self`. There are
   some tools simply check annotations.

2. This approach is correct and has a nice covariant bound that adds
   type safety. It is also nice to documentation tools and _somewhat_
   friendly to developers. Type checkers, pyright that I use, always
   shows the the bounded type '_AsyncClient' rather than the subtype.
   Aslo, it requires more key strokes. Not good, not good.

   It is used by `BaseException.with_traceback`
   See https://github.com/python/typeshed/pull/4298/files

3. This approach always type checks, and I believe it _will_ be the
   official solution in the future. Fun fact, Rust has a Self type
   keyword. It is slightly unfriendly to documentation, but is simple to
   implement and easy to understand for developers. Most importantly,
   type checkers love it.

   See https://github.com/python/mypy/issues/1212

But, we can have 2 and 3 combined:

```python
_Base = typing.TypeVar('_Base', bound=Base)

class Base:
   def __enter__(self: _Base) -> _Base:
      return self

class Derive(Base): ...

with Derived() as derived:
   ...  # type of derived is Derived and it's a subtype of Base
```

* revert back type of of SteamContextManager to Response

* Remove unused type definitions

* Add comment and link to PEP484 for clarification

* Switch to `T = TypeVar("T", covariant=True)`

* fixup! Switch to `T = TypeVar("T", covariant=True)`

* Add back bound=xxx in TypeVar

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoFix typo in CHANGELOG (#1337)
Tom Christie [Fri, 2 Oct 2020 12:15:23 +0000 (13:15 +0100)] 
Fix typo in CHANGELOG (#1337)

5 years agoVersion 0.15.5 (#1335) 0.15.5
Tom Christie [Thu, 1 Oct 2020 12:57:08 +0000 (13:57 +0100)] 
Version 0.15.5 (#1335)

* Version 0.15.5

* Tweak ChangeLog

5 years agoAdd `response.next_request` (#1334)
Tom Christie [Thu, 1 Oct 2020 12:52:03 +0000 (13:52 +0100)] 
Add `response.next_request` (#1334)

* Add response.next_request

* Add response.next_request

* Add response.next_request to the docs

5 years agoSmall namedtuple refactor (#1329)
Johannes [Sun, 27 Sep 2020 20:15:04 +0000 (21:15 +0100)] 
Small namedtuple refactor (#1329)

Plus order consistency because why not..

5 years agoVersion 0.15.4 (#1327) 0.15.4
Tom Christie [Fri, 25 Sep 2020 11:34:52 +0000 (12:34 +0100)] 
Version 0.15.4 (#1327)

* Version 0.15.4

* Update CHANGELOG

* Update CHANGELOG

* Update CHANGELOG

5 years agoSupport header comparisons with dict or list. (#1326)
Musale Martin [Fri, 25 Sep 2020 11:28:34 +0000 (14:28 +0300)] 
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>
5 years agoFix automatic .read() when Response instances are created with content=<str> (#1324)
Tom Christie [Fri, 25 Sep 2020 10:29:17 +0000 (11:29 +0100)] 
Fix automatic .read() when Response instances are created with content=<str> (#1324)

5 years agoFix warning test case (#1322)
Tom Christie [Thu, 24 Sep 2020 16:50:30 +0000 (17:50 +0100)] 
Fix warning test case (#1322)

5 years agoRemove seed-isort-config (#1321)
Johannes [Thu, 24 Sep 2020 10:08:07 +0000 (11:08 +0100)] 
Remove seed-isort-config (#1321)

As of isort 5 seed-isort-config is no longer needed.

We can get rid of some explicit config too as it's now more clever.

5 years agoRelease 0.15.3 (#1318) 0.15.3
Florimond Manca [Thu, 24 Sep 2020 09:39:02 +0000 (11:39 +0200)] 
Release 0.15.3 (#1318)

5 years agoProperly close stream on async response close (#1316)
daa [Thu, 24 Sep 2020 07:42:26 +0000 (10:42 +0300)] 
Properly close stream on async response close (#1316)

5 years agoVersion 0.15.2 (#1314) 0.15.2
Tom Christie [Wed, 23 Sep 2020 10:28:22 +0000 (11:28 +0100)] 
Version 0.15.2 (#1314)

* Fix response.elapsed

* Version 0.15.2

5 years agoFix response.elapsed (#1313)
Tom Christie [Wed, 23 Sep 2020 10:26:12 +0000 (11:26 +0100)] 
Fix response.elapsed (#1313)

5 years agoFix stream unsetting auth (#1312)
Tom Christie [Wed, 23 Sep 2020 10:25:54 +0000 (11:25 +0100)] 
Fix stream unsetting auth (#1312)

* Fix ASGITransport path escaping

* Add failing test case for auth with streaming

* Fix .stream setting auth=None

5 years agoupdate arg name to `max_keepalive_connections` (#1309)
emlazzarin [Wed, 23 Sep 2020 09:42:21 +0000 (02:42 -0700)] 
update arg name to `max_keepalive_connections` (#1309)

The old name `max_keepalive` was removed recently, so this updates the docs.

5 years agoVersion 0.15.1 (#1308) 0.15.1
Tom Christie [Wed, 23 Sep 2020 09:12:50 +0000 (10:12 +0100)] 
Version 0.15.1 (#1308)

* Update CHANGELOG.md

* Update __version__.py

5 years agoFix ASGITransport path escaping (#1307)
Tom Christie [Wed, 23 Sep 2020 08:37:19 +0000 (09:37 +0100)] 
Fix ASGITransport path escaping (#1307)

5 years agoUpdate docs for 0.15 (#1306)
Tom Christie [Tue, 22 Sep 2020 10:57:14 +0000 (11:57 +0100)] 
Update docs for 0.15 (#1306)

5 years agoInclude 0.15.0 release date. (#1305)
Tom Christie [Tue, 22 Sep 2020 10:51:52 +0000 (11:51 +0100)] 
Include 0.15.0 release date. (#1305)

5 years agoInclude curio support in CHANGELOG (#1304) 0.15.0
Tom Christie [Tue, 22 Sep 2020 10:49:33 +0000 (11:49 +0100)] 
Include curio support in CHANGELOG (#1304)

5 years agoVersion 0.15.0 (#1301)
Tom Christie [Tue, 22 Sep 2020 10:44:28 +0000 (11:44 +0100)] 
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>
5 years agoFinesse URL properties (#1285)
Tom Christie [Mon, 21 Sep 2020 10:35:25 +0000 (11:35 +0100)] 
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

5 years agoSupport Response(text=...), Response(html=...), Response(json=...) (#1297)
Tom Christie [Mon, 21 Sep 2020 10:19:19 +0000 (11:19 +0100)] 
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=...)

5 years agoUpdate _client.py (#1300)
Tom Christie [Fri, 18 Sep 2020 13:17:03 +0000 (14:17 +0100)] 
Update _client.py (#1300)

5 years agoNeater Host header logic on redirects (#1299)
Tom Christie [Fri, 18 Sep 2020 11:00:43 +0000 (12:00 +0100)] 
Neater Host header logic on redirects (#1299)

5 years agoNetRC lookups should use host, not host+port (#1298)
Tom Christie [Fri, 18 Sep 2020 10:50:13 +0000 (11:50 +0100)] 
NetRC lookups should use host, not host+port (#1298)

5 years agoRefactor content streams (#1296)
Tom Christie [Fri, 18 Sep 2020 09:50:15 +0000 (10:50 +0100)] 
Refactor content streams (#1296)

* Refactor content_streams internally

* Tidy up multipart

* Use ByteStream annotation internally

5 years agoDrop ContentStream (#1295)
Tom Christie [Fri, 18 Sep 2020 07:41:09 +0000 (08:41 +0100)] 
Drop ContentStream (#1295)

* Drop ContentStream

5 years agoRequests from transport API (#1293)
Tom Christie [Thu, 17 Sep 2020 10:59:42 +0000 (11:59 +0100)] 
Requests from transport API (#1293)

* Refactoring to support instantiating requests from transport API

* Minor refactoring

5 years agoencode -> encode_request (#1292)
Tom Christie [Thu, 17 Sep 2020 08:33:36 +0000 (09:33 +0100)] 
encode -> encode_request (#1292)

5 years agoUpdate README.md (#1291)
Tom Christie [Thu, 17 Sep 2020 08:11:41 +0000 (09:11 +0100)] 
Update README.md (#1291)

* Update README.md

* Update index.md

5 years agoFix function name in event hooks docs (#1290)
Stephen Brown II [Wed, 16 Sep 2020 01:45:20 +0000 (19:45 -0600)] 
Fix function name in event hooks docs (#1290)

5 years agoSeperate `content=...` and `data=...` parameters (#1266)
Tom Christie [Tue, 15 Sep 2020 12:36:10 +0000 (13:36 +0100)] 
Seperate `content=...` and `data=...` parameters (#1266)

* Seperate content=... and data=... parameters

* Update compatibility.md

5 years agoEvent hooks (#1246)
Tom Christie [Tue, 15 Sep 2020 11:05:39 +0000 (12:05 +0100)] 
Event hooks (#1246)

* Add EventHooks internal datastructure

* Add support for 'request' and 'response' event hooks

* Support Client.event_hooks property

* Handle exceptions raised by response event hooks

* Docs for event hooks

* Only support 'request' and 'response' event hooks

* Add event_hooks to top-level API

* Event hooks

* Formatting

* Formatting

* Fix up event hooks test

* Add test case to confirm that redirects/event hooks don't currently play together correctly

* Refactor test cases

* Make response.request clear in response event hooks docs

* Drop merge marker

* Request event hook runs as soon as we have an auth-constructed request

5 years agoDrop chardet (#1269)
Tom Christie [Tue, 15 Sep 2020 10:20:19 +0000 (11:20 +0100)] 
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>
5 years agoRefactor test_auth.py to use `MockTransport` class. (#1288)
Tom Christie [Mon, 14 Sep 2020 16:44:05 +0000 (17:44 +0100)] 
Refactor test_auth.py to use `MockTransport` class. (#1288)

* Use tests.utils.MockTransport

* Use tests.utils.MockTransport

5 years agoRefactoring of models api (#1284)
cdeler [Mon, 14 Sep 2020 11:16:45 +0000 (14:16 +0300)] 
Refactoring of models api (#1284)

* Made Request.prepare private (i.e. renamed it to _prepare)

* Added bytes as a new possible QueryParamTypes

5 years agoPin `flake8-pie` (#1286)
Tom Christie [Sat, 12 Sep 2020 18:41:47 +0000 (19:41 +0100)] 
Pin `flake8-pie` (#1286)

* Pin `flake8-pie`

* Update requirements.txt

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoRefactor tests to use `MockTransport(<handler_function>)` (#1281)
Tom Christie [Sat, 12 Sep 2020 10:16:10 +0000 (11:16 +0100)] 
Refactor tests to use `MockTransport(<handler_function>)` (#1281)

* Support Response(content=<bytes iterator>)

* Update test for merged master

* Add MockTransport for test cases

* Use MockTransport for redirect tests

* Reduce change footprint

* Reduce change footprint

* Clean up headers slightly

* Update requirements.txt

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoRefactor to use isinstance(..., typing.Iterator) (#1282)
Tom Christie [Fri, 11 Sep 2020 13:37:51 +0000 (14:37 +0100)] 
Refactor to use isinstance(..., typing.Iterator) (#1282)

5 years agoSupport `Response(content=<bytes iterator>)` (#1265)
Tom Christie [Fri, 11 Sep 2020 09:28:18 +0000 (10:28 +0100)] 
Support `Response(content=<bytes iterator>)` (#1265)

* Support Response(content=<bytes iterator>)

* Update test for merged master

5 years agoUpdate compatibility.md: mention differing query parameter handling (#1262)
Bart [Thu, 10 Sep 2020 19:22:14 +0000 (21:22 +0200)] 
Update compatibility.md: mention differing query parameter handling (#1262)

* Update compatibility.md

* Update docs/compatibility.md

* Update docs/compatibility.md

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoMinor decoder refactoring. (#1276)
Tom Christie [Thu, 10 Sep 2020 14:10:31 +0000 (15:10 +0100)] 
Minor decoder refactoring. (#1276)

* Switch auth/redirect methods to follow flow of execution better

* Drop response.decoder property

* Decoder -> ContentDecoder

* Decoder -> ContentDecoder

5 years agoProgress examples (#1272)
Tom Christie [Thu, 10 Sep 2020 11:28:08 +0000 (12:28 +0100)] 
Progress examples (#1272)

* Progress examples

* Update advanced.md

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoSwitch auth/redirect methods to follow flow of execution better (#1273)
Tom Christie [Thu, 10 Sep 2020 10:44:36 +0000 (11:44 +0100)] 
Switch auth/redirect methods to follow flow of execution better (#1273)

5 years agoAdd progress to streaming download (#1268)
cdeler [Thu, 10 Sep 2020 09:16:00 +0000 (12:16 +0300)] 
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>
5 years agoSwap auth/redirects ordering (#1267)
Tom Christie [Thu, 10 Sep 2020 08:12:05 +0000 (09:12 +0100)] 
Swap auth/redirects ordering (#1267)

* Internal refactoring to swap auth/redirects ordering

* Test for auth with cross domain redirect

5 years agoAdd support for sync-specific or async-specific auth flows (#1217)
Florimond Manca [Wed, 9 Sep 2020 13:37:20 +0000 (15:37 +0200)] 
Add support for sync-specific or async-specific auth flows (#1217)

* Add support for async auth flows

* Move body logic to Auth, add sync_auth_flow, add NoAuth

* Update tests

* Stick to next() / __anext__()

* Fix undefined name errors

* Add docs

* Add unit tests for auth classes

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoFixed test_multiple_set_cookie (#1270)
cdeler [Wed, 9 Sep 2020 09:01:39 +0000 (12:01 +0300)] 
Fixed test_multiple_set_cookie (#1270)

* Fixed test_multiple_set_cookie

* Update test_cookies.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoDrop `request.timer` attribute. (#1249)
Tom Christie [Mon, 7 Sep 2020 08:06:14 +0000 (09:06 +0100)] 
Drop `request.timer` attribute. (#1249)

* Drop request.timer attribute
* Response(..., elapsed_func=...)

5 years agoEdited documentation about proxy-envs usage (#404) (#1257)
cdeler [Sun, 6 Sep 2020 11:52:37 +0000 (14:52 +0300)] 
Edited documentation about proxy-envs usage (#404) (#1257)

* Edited documentation about proxy-envs usage (#404)

* PR review (#404)

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* PR review (#404)

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

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoUse shebang-style headers in environment variables docs (#1260)
Florimond Manca [Sat, 5 Sep 2020 08:30:14 +0000 (10:30 +0200)] 
Use shebang-style headers in environment variables docs (#1260)

5 years agoRaise a proper type error on invalid URL type (#1259)
Tyler Wozniak [Fri, 4 Sep 2020 21:14:59 +0000 (14:14 -0700)] 
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

5 years agoDrop urllib3 in favor of public gist (#1182)
Florimond Manca [Fri, 4 Sep 2020 20:56:36 +0000 (22:56 +0200)] 
Drop urllib3 in favor of public gist (#1182)

* Drop urllib3 in favor of public gist

* Drop urllib3 coverage omit

* Drop recommendation to use urllib3 transport during Requests migration

* Add urllib3-transport to 3p pkgs

* Drop urllib3 from dependencies list in README / docs home page

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoFix HTTPError doc (#1255)
Taras Sotnikov [Fri, 4 Sep 2020 17:22:05 +0000 (19:22 +0200)] 
Fix HTTPError doc (#1255)

5 years agoHeader refinements (#1248)
Tom Christie [Wed, 2 Sep 2020 20:32:48 +0000 (21:32 +0100)] 
Header refinements (#1248)

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoIssue warning on unclosed `AsyncClient`. (#1197)
cdeler [Wed, 2 Sep 2020 12:02:59 +0000 (15:02 +0300)] 
Issue warning on unclosed `AsyncClient`. (#1197)

* Made Client and AsyncClient checking for being closed in __del__ (#871)

* Changed the AsyncClient closing warning type from ResourceWarning (which is too quiet) to UserWarning  (#871)

* Fixed tests and client's __exit__ and __aexit__ after the difficult merge (#871)

* Update test_proxies.py

* Update test_proxies.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoVersion 0.14.3 (#1247) 0.14.3
Tom Christie [Wed, 2 Sep 2020 11:17:23 +0000 (12:17 +0100)] 
Version 0.14.3 (#1247)

5 years agoDrop Response(..., request=...) style in test cases. (#1243)
Tom Christie [Wed, 2 Sep 2020 09:10:32 +0000 (10:10 +0100)] 
Drop Response(..., request=...) style in test cases. (#1243)

* Drop Response(..., request=...) style in test cases except where required

* Lowercase variable name

5 years agoAdd "Early Hints" and "Too Early" to Status Codes (#1244)
Stephen Brown II [Wed, 2 Sep 2020 09:04:47 +0000 (03:04 -0600)] 
Add "Early Hints" and "Too Early" to Status Codes (#1244)

To align with Python 3.9: https://docs.python.org/3.9/whatsnew/3.9.html#http

> HTTP status codes 103 EARLY_HINTS, 418 IM_A_TEAPOT and 425 TOO_EARLY are added to http.HTTPStatus. (Contributed by Dong-hee Na in bpo-39509 and Ross Rhodes in bpo-39507.)

https://github.com/python/cpython/blob/da52be47690da0d9f78d0dce9ee5c3e4dbef49e1/Lib/http/__init__.py

5 years agoUse sync client in test cases (#1241)
Tom Christie [Tue, 1 Sep 2020 20:44:52 +0000 (21:44 +0100)] 
Use sync client in test cases (#1241)

* Use sync client in test cases

* Use plain client __init__ style in preference to context manager

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoMinor test refactoring (#1242)
Tom Christie [Tue, 1 Sep 2020 20:41:30 +0000 (21:41 +0100)] 
Minor test refactoring (#1242)

5 years agoMake the response's request parameter optional (#1238)
tbascoul [Tue, 1 Sep 2020 14:14:57 +0000 (16:14 +0200)] 
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>
5 years agoHandle multiple auth headers correctly (#1240)
Tom Christie [Tue, 1 Sep 2020 13:08:10 +0000 (14:08 +0100)] 
Handle multiple auth headers correctly (#1240)

Handle multiple auth headers correctly

5 years agoClosing AsyncClient in all tests (#871) (#1219)
cdeler [Mon, 31 Aug 2020 15:02:28 +0000 (18:02 +0300)] 
Closing AsyncClient in all tests (#871) (#1219)

All over the AsyncClient invocation is made using context manager or with try-finally block

5 years agoReplace httpx.URL for str in tests (#1237)
Eduardo Enriquez [Sun, 30 Aug 2020 06:01:37 +0000 (08:01 +0200)] 
Replace httpx.URL for str in tests (#1237)

Co-authored-by: Eduardo Enriquez (eduzen) <eduardo.enriquez@freshbooks.com>
5 years agochore: direct questions towards Gitter chat (#1225)
Moritz E. Beber [Thu, 27 Aug 2020 15:57:05 +0000 (17:57 +0200)] 
chore: direct questions towards Gitter chat (#1225)

5 years agoUse and pin black 20 (#1229)
Florimond Manca [Thu, 27 Aug 2020 13:57:53 +0000 (15:57 +0200)] 
Use and pin black 20 (#1229)

5 years agoBetter test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)
Tom Christie [Wed, 26 Aug 2020 13:10:23 +0000 (14:10 +0100)] 
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.

5 years agoContext managed transports (#1218)
Tom Christie [Wed, 26 Aug 2020 11:05:05 +0000 (12:05 +0100)] 
Context managed transports (#1218)

* Context managed transports

* Update httpx/_client.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_client.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update tests/client/test_client.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update tests/client/test_async_client.py

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Code comment around close/__enter__/__exit__ interaction

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoVersion 0.14.2 (#1207) 0.14.2
Tom Christie [Mon, 24 Aug 2020 10:03:26 +0000 (11:03 +0100)] 
Version 0.14.2 (#1207)

* Version 0.14.2

* Update CHANGELOG.md

* Update release notes

5 years agoMade cookies construct-able from a list of tuples (#1211)
cdeler [Mon, 24 Aug 2020 09:44:48 +0000 (12:44 +0300)] 
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)

5 years agoPackaging dependancy tweaks (#1206)
Joe [Fri, 21 Aug 2020 11:30:57 +0000 (19:30 +0800)] 
Packaging dependancy tweaks (#1206)

* Remove idna and add brotli to extras

* Update dependency docs

* Update BrotliDecoder error message

* Add nocover

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoFix request auto headers (#1205)
Tom Christie [Fri, 21 Aug 2020 11:03:15 +0000 (12:03 +0100)] 
Fix request auto headers (#1205)

* Failing test case

* Fix auto_headers in Request.prepare()

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
5 years agoAdjust 1.0 expectations. (#1202)
Tom Christie [Thu, 20 Aug 2020 15:30:45 +0000 (16:30 +0100)] 
Adjust 1.0 expectations. (#1202)

* Adjust 1.0 expectations.

Not sure why I thought saying "expected September 2020" was a good idea.
Like *maybe* that'll happen, but no problem with us taking our time if there's areas we want to be really firm about first. *Eg finer details in the Transport API*.

* Update index.md

5 years agoAdd stream docstring (#1200)
Joe [Thu, 20 Aug 2020 09:28:28 +0000 (17:28 +0800)] 
Add stream docstring (#1200)

* Add stream() docstring

* Update docs

5 years agoCleanup docstring leftover for #1183 (#1201)
Joe [Thu, 20 Aug 2020 09:03:20 +0000 (17:03 +0800)] 
Cleanup docstring leftover for #1183 (#1201)

Co-authored-by: Tom Christie <tom@tomchristie.com>
5 years agoAdd `proxies` parameter to top-level API functions (#1198)
Joe [Thu, 20 Aug 2020 07:55:35 +0000 (15:55 +0800)] 
Add `proxies` parameter to top-level API functions (#1198)

* Add `proxies` parameter to top-level API functions

* Fix typo

5 years agoInclude underlying httpcore exception tracebacks (#1199)
Tom Christie [Wed, 19 Aug 2020 16:38:52 +0000 (17:38 +0100)] 
Include underlying httpcore exception tracebacks (#1199)