Commit Graph

539 Commits

Author SHA1 Message Date
Y.D.X
e4241c6155
Drop private imports from test_proxies.py (#2850) 2023-09-16 21:58:56 +01:00
Musale Martin
88e8431437
Add cookies to the retried request when performing digest authentication. (#2846)
* Add cookies from the response to the retried request

* Conditionally add cookies from the response

* Fix failing auth module tests

* Fix linting error

* Add tests to check set cookies from server
2023-09-15 10:52:11 +01:00
Iurii Pliner
b40c04dfa6
Drop support for Python 3.7 (#2813)
* Drop Python 3.7 support

* Fix lint

* Changelog
2023-08-09 10:02:28 +01:00
Trim21
9415af643f
Make raise_for_status chainable (#2776)
* merge upstream

* lint

* Update test_async_client.py

* update docs

* add example

* Update docs/quickstart.md

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

* Update CHANGELOG.md

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

* Update docs/quickstart.md

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

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-08-01 10:22:58 +01:00
Zanie
18d7721c38
Use Mozilla documentation instead of httpstatuses.com for HTTP error reference (#2768) 2023-07-13 15:17:07 -05:00
Zanie Adkins
920333ea98
Always encode forward slashes as %2F in query parameters (#2723)
* Always encode forward slashes as `%2F` in query parameters

* Revert inclusion of "%"

This is expected to fail tests due to double escaping

* Update `urlencode`

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-06-09 10:06:56 +01:00
Nik
a682f6f1c7
Fix exception suppression in asgi transport (#2669) 2023-05-21 01:17:23 +01:00
Peter Lazorchak
abb994c0c2
Ensure all WSGITransport environs have a SERVER_PROTOCOL (#2708) 2023-05-19 11:38:18 +01:00
Tom Christie
ee432c0d30
Fix for gen-delims escaping behaviour in path/query/fragment (#2701) 2023-05-09 14:20:12 +01:00
Tom Christie
26dc39213a
Additional context in InvalidURL exceptions (#2675) 2023-04-20 12:17:44 +01:00
Florimond Manca
cca62060cb
Drop private imports from test_decoders.py (#2570)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-04-19 14:16:29 +01:00
Tom Christie
9ae170a936
Fix optional percent encoding behaviour. (#2671)
* Tests for failing optional percent encoding

* Linting

* Fix for optional percent escaping
2023-04-19 13:21:42 +01:00
Jiayun Shen
15d09a3bbc
fix: NO_PROXY should support IPv4, IPv6 and localhost (#2659)
* fix: NO_PROXY supports IPv4, IPv6 and localhost

* add more tests for test_get_environment_proxies

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-04-19 13:14:37 +01: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
Tom Christie
f1157dbc41
Use standard logging style (#2547)
* Use standard logging style

* Add docs for logging

* Drop out-of-date HTTPX_LOG_LEVEL variable docs
2023-03-20 11:30:11 +00:00
Gianni Tedesco
85c5898d8e
Change LineDecoder to match stdlib splitlines, resulting in significant speed up (#2423)
* Replace quadratic algo in LineDecoder

Leading to enormous speedups when doing things such as
Response(...).iter_lines() as described on issue #2422

* Update httpx/_decoders.py

* Update _decoders.py

Handle text ending in `\r` more gracefully.
Return as much content as possible.

* Update test_decoders.py

* Update _decoders.py

* Update _decoders.py

* Update _decoders.py

* Update httpx/_decoders.py

Co-authored-by: cdeler <serj.krotov@gmail.com>

* Update _decoders.py

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: cdeler <serj.krotov@gmail.com>
2023-03-16 14:29:15 +00:00
Florimond Manca
a934c36a85
Drop private imports from test_urlparse.py (#2572)
* Drop private imports from test_urlparse.py

* Coverage

* Drop ._uri_reference
2023-02-15 14:43:19 +00:00
Adrian Garcia Badaracco
f0fd91925b
fix type annotation for MockTransport (#2581)
* fix type annotation for MockTransport

* add type ignore

* better type checks

* better type checks

* add pragma

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-02-09 16:05:07 +00:00
Florimond Manca
18e0ae45ca
Drop private imports from test_exported_members.py (#2573)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-02-09 16:00:27 +00:00
Florimond Manca
ef06f7d076
Drop private imports in tests/conftest.py (#2569)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-02-09 15:54:53 +00:00
Florimond Manca
78d381fc7d
Drop private imports from test_main.py (#2574)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-02-09 15:50:09 +00:00
Florimond Manca
7488b15226
Drop private imports from test_exceptions.py (#2571) 2023-02-08 19:35:52 -05:00
Tom Christie
59914c7690
Add NetRCAuth() class. (#2535)
* NetRCAuth class

* Add docs for httpx.NetRCAuth()

* Drop failing cross-domain test for NetRCAuth()

* Update tests

* Update httpx/_auth.py

* Add tests for netrc file with no password
2023-01-12 11:27:46 +00:00
Tom Christie
7947b56076
Drop private import of 'encode_request' in test_multipart (#2525) 2023-01-10 11:23:14 +00:00
Tom Christie
a6af45edac
Use '%20' for encoding spaces in query parameters. (#2543)
* Add failing test

* Fix failing test case

* Add urlencode

* Update comment
2023-01-10 11:16:09 +00:00
Tom Christie
57daabf673
Drop rfc3986 requirement. (#2252)
* Drop RawURL

* First pass at adding urlparse

* Update urlparse

* Add urlparse

* Add urlparse

* Unicode non-printables can be valid in IDNA hostnames

* Update _urlparse.py docstring

* Linting

* Trim away ununsed codepaths

* Tweaks for path validation depending on scheme and authority presence

* Minor cleanups

* Minor cleanups

* full_path -> raw_path, forr internal consistency

* Linting fixes

* Drop rfc3986 dependency

* Add test for #1833

* Linting

* Drop 'rfc3986' dependancy from README and docs homepage

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2023-01-10 10:36:15 +00:00
Michael Adkins
bddd774ce0
Revert "Raise TypeError on invalid query params. (#2523)" (#2539)
This reverts commit 4cbf13ece2.
2023-01-04 09:23:32 +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
4cbf13ece2
Raise TypeError on invalid query params. (#2523)
* Raise TypeError on invalid query params

* Fix TypeError

* Update tests/models/test_queryparams.py

Co-authored-by: Michael Adkins <contact@zanie.dev>

* Linting

* Fix exception check

Co-authored-by: Michael Adkins <contact@zanie.dev>
2022-12-30 20:56:48 +00:00
Tom Christie
b82fbe2c13
Drop private import of 'format_form_param' from tests (#2500)
* Drop private import of 'format_form_param' from tests

* Drop unused code path
2022-12-12 16:31:29 +00:00
Tom Christie
b97c0594a5
Streaming multipart support (#2382)
* Streaming multipart support

* Update tests for streaming multipary
2022-12-12 16:14:56 +00:00
Tom Christie
af56476a8c
Drop unneccessary private import in tests (#2498) 2022-12-12 10:43:46 +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
563a1031f5
Remove some private imports from test_decoders (#2496) 2022-12-06 18:22:04 +00:00
Tom Christie
71a1589928
Use httpx public API for 'test_content' tests (#2494) 2022-12-06 13:27:05 +00:00
Tom Christie
7985f685ca
Use consistent import style (#2493) 2022-12-06 11:58:30 +00:00
Demetri
40a0da093b
Add back in URL.raw with NamedTuple (#2481)
* add back in URL.raw with NamedTuple

* Update _urls.py

* Update _urls.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-12-02 16:20: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
884a69a902
Typing: enable strict_equality (#2480)
- ignore mypy when it comes to comparing an IntEnum member with an int
- Correct type hint for `test_wsgi_server_port`'s `expected_server_port`
  parameter.

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-12-02 08:45:28 +00:00
Martijn Pieters
57aa5b08a4
Enable no_implicit_reexport (#2475)
- Add explicit exports for names imported from `_compat`
- Correct imports of `URL` (from `._urls`, not via `._models`)
- Correct import of the uvicorn `Server` class

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-30 13:11:22 +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
rettier
8327e13454
reuse the digest auth state to avoid unnecessary requests (#2463)
* reuse the digest auth challenge to avoid sending twice as many requests

* fix for digest testcase

* ran testing/linting scripts

* codereview changes, removed tomchristie username from all authentication tests

Co-authored-by: Philipp Reitter <p.reitter@accessio.at>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-29 17:05:37 +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
1b4e7fbb48
Typing: always fill in generic type parameters (#2468)
* Typing: always fill in generic type parameters

Being explicit about the parameters helps find bugs and makes the library
easier to use for users.

- Tell mypy to disallow generics without parameter values
- Give all generic types parameters values

* fix things that aren't coming in from other commits

* lint

Co-authored-by: Martijn Pieters <mj@zopatista.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-29 16:36:03 +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
883cf8ca6f
Drop multipart requirement from tests (#2456) 2022-11-21 10:29:31 +00:00
Tom Christie
8752e2672c
Drop .read/.aread from SyncByteStream/AsyncByteStream (#2407) 2022-11-07 14:01:29 +00:00
Vincent Fazio
1aea9539bb
Drop cgi module from test_multipart (#2424)
* Use multipart instead of cgi for multipart tests

The cgi module has been deprecated as of python 3.11.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

* Update setup.cfg

All references to the cgi module have all been removed so there's no
longer a need to silence those deprecation warnings.

The deprecation warning for certifi is resolved as of version 2022.09.24.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-03 11:29:23 +00:00
Tom Christie
0ebe9259ac
Allow str content for multipart upload files (#2400) 2022-10-06 17:53:51 +01:00