Commit Graph

1013 Commits

Author SHA1 Message Date
Florimond Manca
3d192aed45
Allow passing additional pytest args to scripts/test (#1710) 2021-06-24 11:15:59 +01:00
Joe
6b93787514
Test under Python 3.10b3 (#1707) 2021-06-22 13:25:19 +01:00
Sidharth Vinod
bb7f7dfda8
Add httpx-caching (#1694) 2021-06-17 13:30:33 +01:00
Sidharth Vinod
5096663181
Fix third party documentation link (#1691) 2021-06-17 11:37:03 +01:00
Tom Christie
f312e629bf
Version 0.18.2 (#1690)
* Version 0.18.2
2021-06-17 11:29:22 +01:00
Tom Christie
b43af721cd
Treat warnings as errors (#1687)
* Treat warnings as errors

* Defensive programming in Client.__del__ to avoid possible warnings on partially initialized instances

* Linting

* Ignore linting getattr errors in __del__

* getattr requires a default

* Tighten up closing of auth_flow generators

* Switch multipart test to open file in a context manager

* Ignore warnings on uvicorn

* Drop -Werror from addopts

* Warings specified entirely in 'filterwarnings' section

* Use ssl.PROTOCOL_TLS_CLIENT instead of deprecated ssl.PROTOCOL_TLS

* Push 'check_hostname = False' above 'context.verify_mode = ssl.CERT_NONE'

* Introduce set_minimum_tls_version_1_2 compatible across different python versions

* Commenting

* Add missing annotation

* Exclude _compat from coverage

Co-authored-by: Joe <nigelchiang@outlook.com>
Co-authored-by: jianghang <jianghang@didiglobal.com>
2021-06-16 15:34:12 +01:00
laggardkernel
47d712c01c
Fix typo (#1688) 2021-06-16 07:52:39 +02:00
Vibhu Agarwal
f8cb7f5f02
[Docs] Add AnyIO under "Supported async environments" (#1673)
* [Docs] Add AnyIO under "Supported async environments"

* Update docs/async.md

Co-authored-by: Florimond Manca <15911462+florimondmanca@users.noreply.github.com>

Co-authored-by: Florimond Manca <15911462+florimondmanca@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-06-16 07:19:39 +02:00
Mei
604d09d7d7
Add netrc environment variable into the documentation (#1675)
* Adding netrc environment variable documentation

* Update docs/environment_variables.md

Co-authored-by: Tom Christie <tom@tomchristie.com>

* Modifications about netrcfile environment variable

* Change uppercase "A" in netrcfile env variable into lowercase

* Added some words and a dot before "my_netrc" in the console example

* changed a typo "rather that" into "rather than" in advanced.md

* changed netrc environment variable in example part

* modified title for netrc environment variable part in doc

* Deleted the dot in title of netrc environment variable

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-06-16 07:04:47 +02:00
Marcelo Trylesinski
3231211aa3
👷 Add Python 3.10 beta to the CI (#1682)
* 👷 Add Python 3.10 beta to the CI
* ⬆️ Upgrade pytest from 5.* to 6.*
2021-06-15 11:59:30 +01:00
Marcelo Trylesinski
f818a028f9
Update PULL_REQUEST_TEMPLATE.md (#1681)
Small typo on the PR template.
2021-06-14 15:44:27 +01:00
Marcelo Trylesinski
4a3e5e12c9
Add types-certifi to satisfy mypy 0.902 (#1679) 2021-06-14 14:41:22 +01:00
K900
776dbb578b
docs: slightly clarify event hooks (#1645)
* Be more specific about when the hooks are called
* Explicitly mention and demonstrate that hooks are allowed to modify requests

See https://github.com/encode/httpx/discussions/1637
2021-05-21 10:30:30 +01:00
bli74
9b17671f15
Support HTTP/2 prior-knowledge, using httpx.Client(http1=False, http2=True). (#1624)
* Pass flag http1 to httpcore.

* Update httpcore version, reorder parameter list

Co-authored-by: ebertli <bert.lindemann@ericsson.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-05-11 10:40:46 +01:00
Tom Christie
69409bb8b9
Switch to USE_CLIENT_DEFAULT instead of UNSET. (#1634)
* 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=...'

* Switch to USE_CLIENT_DEFAULT

* Switch to USE_CLIENT_DEFAULT

* Linting
2021-05-11 10:25:01 +01:00
Jaakko Lappalainen
7025dd1952
fix typo in http2 section (#1632) 2021-05-09 00:49:14 +08:00
Vytautas Liuolia
2e4b308d7a
Make the MockTransport example more robust/correct (#1621) 2021-05-02 20:04:12 +02: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
54f4194c38
Version 0.18.1 (#1617)
* Version 0.18.1

* Update CHANGELOG.md
2021-04-29 13:57:12 +01:00
Tom Christie
589c5a0bc3
Map httpcore transport close exceptions to httpx exceptions. (#1606) 2021-04-29 12:37:37 +01:00
Tom Christie
81f385c484
Add missing timeout=... to top-level httpx.stream() function. (#1613) 2021-04-29 11:08:48 +01:00
Tom Christie
4fbf2751ec
Stream tweak (#1607) 2021-04-28 20:39:11 +01:00
Tom Christie
760af43b4f
Update brotli support to use the brotlicffi package (#1605)
* Update brotli support to use the brotlicffi package
2021-04-28 10:09:29 +01:00
Tom Christie
0c2cb240df
Version 0.18.0 (#1576)
* Version 0.18.0
2021-04-27 15:20:22 +01:00
Tom Christie
0a8b44e67d
Perform port normalization for http, https, ws, wss, and ftp schemes (#1603) 2021-04-27 14:06:23 +01:00
Tom Christie
c927f3e965
Code comments for URL model (#1602) 2021-04-27 11:23:52 +01:00
Tom Christie
e67b0dd15b
Expand URL interface (#1601)
* Expand URL interface

* Add URL query param manipulation methods
2021-04-27 09:01:14 +01:00
Tom Christie
2abb2f214a
Immutable QueryParams (#1600)
* Tweak QueryParams implementation

* Immutable QueryParams
2021-04-26 14:57:02 +01:00
Tom Christie
8fe32c52de
Tweak QueryParams implementation (#1598) 2021-04-26 14:06:12 +01:00
Tom Christie
6e55ca1af9
Escalate 0.17 deprecation warnings to becoming fully deprecated. (#1597) 2021-04-26 11:03:11 +01:00
Tom Christie
39d8ee619e
Differentiate between 'url.host' and 'url.raw_host' (#1590)
* Differentiate between 'url.host' and 'url.raw_host'
2021-04-23 11:00:53 +01:00
Tom Christie
d98e9e7ae7
Support HTTPCore 0.13 (#1588)
* Support HTTPCore 0.13

* Update httpcore minimum version

* Call into 'handle_async_request', not 'arequest'

* Drop unintentional commit

* Update tests
2021-04-21 14:43:18 +01: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
9b8f5af759
httpx.ResponseClosed -> httpx.StreamClosed (#1584)
* ResponseClosed -> StreamClosed

* Update docs for StreamClosed
2021-04-21 10:51:35 +01:00
Tom Christie
6a99f6f2b3
Deprecate per-request cookies (#1574)
* Deprecate per-request cookies

* Update docs/compatibility.md

Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>

* Update httpx/_client.py

Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>

* Update compatibility.md

Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
2021-04-19 11:18:32 +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
8fd5b71016
Drop StreamContextManager in favour of contextlib.contextmanager/asynccontextmanager (#1577)
* Drop StreamContextManager in favour of using contextlib.contextmanager/asyncontextmanager

* Use type: ignore to avoid mypy errors on 3.6
2021-04-19 11:07:07 +01:00
Hannes Ljungberg
ed19995747
Drop Response.call_next leftover attribute (#1578) 2021-04-16 21:05:34 +02: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
073a3284ab
Drop 'Response(on_close=...)' from API (#1572) 2021-04-16 10:03:37 +01:00
ascopes
4870cb5adf
Update verify parameter description (#1575)
Included that the verify parameter can be an SSL context, as it currently is missing information
that is present in the advanced usage section of the documentation, and the type hints are not
showing up in the interface specification.

Amend verify docs for client
2021-04-16 10:03:08 +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
Hemanth kumar
535df6c998
Added docs for using client-side ssl certificates (#1570)
* Added docs for using client-side ssl certificates

* Update docs/advanced.md

Co-authored-by: Joe <nigelchiang@outlook.com>

* Update docs/advanced.md

Co-authored-by: Joe <nigelchiang@outlook.com>

* Update docs/advanced.md

* Update docs/advanced.md

* Update docs/advanced.md

Co-authored-by: Hemanth <hemanth@actionfi.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Joe <nigelchiang@outlook.com>
2021-04-13 20:08:22 +08:00
Tom Christie
eb7433bf8e
Fix up license whitespacing (#1563) 2021-04-09 13:08:34 +01:00
Colin Bounouar
4dec569749
Add httpx-auth and pytest-httpx to third party documentation (#1560) 2021-04-07 23:02:44 +02:00
Jaakko Lappalainen
c1ccdbcb81
added docs for startup/shutdown of ASGI apps (#1554) 2021-04-05 10:55:57 +02:00
Jonas Lundberg
52dd95fb5c
Fix extenstions typo in AsyncHTTPTransport (#1549) 2021-04-01 15:32:20 +01:00
Tom Christie
da2a334f2d
Tweak issue config.yml (#1542)
* Update config.yml

* Update the issue template for neater formatting
2021-03-26 15:07:18 +00:00
Tom Christie
e65a33d3cf
Neater close logic (#1541) 2021-03-26 15:06:05 +00: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