Commit Graph

44 Commits

Author SHA1 Message Date
T-256
4f6edf36e9
test parse_header_links via public api (#3061)
* test `parse_header_links` via public api

* add no-link test

* Update tests/test_utils.py

---------

Co-authored-by: Tom Christie <tom@tomchristie.com>
2024-01-16 10:25:02 +00:00
T-256
c7cd6aa5bd
test obfuscate_sensitive_headers via public api (#3063) 2024-01-16 09:53:23 +00:00
Kar Petrosyan
3b9060ee11
Fix environment proxies (#2741)
* Add red test

* Make the test pass

* Lint

* chanelog

---------

Co-authored-by: Karen Petrosyan <92274156+karosis88@users.noreply.github.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2023-12-14 14:04:04 +00:00
T-256
fd60b1815c
Ruff linter: Use the default line-length (#2922)
Co-authored-by: Tester <Tester@test.com>
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
2023-11-29 13:28:31 +04:00
Tom Christie
1d73150c1f
Cleanup response.json() method (#2911)
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
2023-10-31 10:10:16 +00: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
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
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
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
waterfountain1996
4401d55ecf
Preserve Authorization header on HTTPS redirect (#1850) (#2074)
* Preserve Authorization header on HTTPS redirect (#1850)

* Update httpx/_client.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-02-09 11:18:21 +00:00
Kian Meng, Ang
82ba15b521
Fix typos (#1968) 2021-12-14 15:04:01 +01:00
Tom Christie
47266d763b
Switch follow redirects default (#1808)
* Switch default on allow_redirects to False

* allow_redirects -> follow_redirects

* Update follow_redirects default in top-level API

* Update docs on follow_redirects
2021-09-13 13:21:22 +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
Florimond Manca
f5c27ec7f4
Use and pin black 20 (#1229) 2020-08-27 14:57:53 +01:00
cdeler
0a38695063
Fixed warnings in unit tests suite, caused by #1127 PR (#1137) 2020-08-06 13:41:11 +01:00
Tom Christie
682cad39eb
Cleaner no proxy support (#1103)
* Add internal URLMatcher class

* Use URLMatcher for proxy lookups in transport_for_url

* Docstring

* Pin pytest

* Add support for no-proxies configurations

* Don't call should_not_proxy on each request

* Drop print statements

* Tweak comment

* Tweak comment on domain wildcards

* Update httpx/_utils.py

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

* Pull test_should_not_be_proxied cases into test_proxies_environ

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-08-02 10:00:45 +01:00
Florimond Manca
71d5234305
Rename URLMatcher -> URLPattern (#1109) 2020-08-01 11:07:31 +02:00
Tom Christie
df54890c15
URL matching (#1098)
* Add internal URLMatcher class

* Use URLMatcher for proxy lookups in transport_for_url

* Docstring

* Pin pytest

* Update httpx/_utils.py

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

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-31 10:11:49 +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
Florimond Manca
09672a99dd
Use relative tests directory references (#1052)
* Use relative tests directory references

* Use absolute TESTS_DIR

Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-07-16 16:28:31 +02: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
Tom Christie
3046e920ea
Httpcore interface (#804)
* First pass as switching dispatchers over to httpcore interface

* Updates for httpcore interface

* headers in dispatch API as plain list of bytes

* Integrate against httpcore 0.6

* Integrate against httpcore interface

* Drop UDS, since not supported by httpcore

* Fix base class for mock dispatchers in tests

* Merge master and mark as potential '0.13.dev0' release
2020-04-08 13:32:10 +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
Florimond Manca
e284b84bf9 Rename Client to AsyncClient (with compat synonym) (#680)
* Rename Client to AsyncClient (with compat synonym)

* Document motivation for AsyncClient renaming

Co-authored-by: Tom Christie <tom@tomchristie.com>
2019-12-29 15:34:23 +00:00
Tom Christie
abe0799d70
Refactor netrc handling (#558)
* Refactor netrc handling

* Linting

* Import sorting

* Import sorting
2019-11-28 12:31:15 +00:00
Tom Christie
206c5372a6
Drop sync (#544)
Drop sync client
2019-11-27 10:43:42 +00:00
Florimond Manca
08069e9368
Add DEBUG logs of HTTP requests (#502) 2019-11-06 22:56:25 +01:00
Florimond Manca
2fcf23bbfe
Refactor debug and trace log tests (#506) 2019-11-06 12:04:20 +01:00
Florimond Manca
07586f97e8
Convert debug logs to trace logs (#500)
* Convert debug logs to trace logs

* Update environment variables docs

* Update logging test
2019-11-02 22:40:15 +01:00
mariaS210
7200717e82 Add logic for determining if a URL should be proxied (#472) 2019-10-17 10:58:11 -05:00
Can Sarıgöl
84731c8be5 Cache netrc authentication per-client (#400) 2019-10-16 08:31:47 -05:00
camellia256
49ed77a706 Rely on getproxies for all proxy environment variables (#470) 2019-10-12 10:34:50 -05:00
Florimond Manca
e62e5c3758
Add debug logs to ASGIDispatch (#371)
* Add debug logs to ASGIDispatch

* Tidy up ASGIDispatch

* Log entire scope and ASGI messages

* Obfuscate sensitive headers using common utility

* Update utils.py
2019-09-23 22:49:24 +02:00
Can Sarıgöl
c9810a79d9 Add support for SSL_CERT_FILE and SSL_CERT_DIR (#307) 2019-09-23 10:24:53 -05:00
Seth Michael Larson
b0fa0859a8
Configure Proxy from Client (#353)
* Incorporate suggestions

* Start of proxy config

* Incorporate suggestions

* Add proxies to high-level API, docs

* Update client.py
2019-09-20 12:33:06 -05:00
Roy Williams
05ac117679 Add .elapsed onto Response objects tracking how long a request took. (#351)
* Add `.elapsed` onto Response objects tracking how long a request took.

* Move elapsed timing from send methods into _get_response

* Address feedback

* Update tests/test_api.py

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
2019-09-18 20:29:01 +02:00
Bakhtiyor Ruziev
e34d280673 Add server.url property in tests (#300)
* Add server.url to test server

* Move a property to top of the class
2019-09-01 09:07:22 +02:00
Seth Michael Larson
6f4f186522
Add easier debug logging for users (#277)
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
2019-08-27 11:43:13 -05:00
euri10
cad9c03500 Added links property to BaseResponse (#211)
* Added docstring and better typing for parsed_header_links

* Added docstring and better typing for links property
Added tests for it too

* Added --diff to black check to see where CI fails
Relaxed travis build on master only

* Fixed black issue removing a \t

* Put noxfile and travis.yml as they were before
2019-08-16 09:07:52 -05:00
Can Sarıgöl
9536b76f5c Fail unit tests without 100% coverage (#206) 2019-08-14 21:45:28 -05:00
Seth Michael Larson
80dc3e274e
Use nox for automation and CI (#128) 2019-08-13 08:39:35 -05:00
Can Sarıgöl
919e8d3f9b added netrc support (#177) 2019-08-01 09:32:00 +01:00
Tom Christie
2d09d5b36c
Renaming -> httpx (#129)
* Renaming -> httpx

* Renaming to httpx
2019-07-19 15:15:16 +01:00
Yeray Diaz Diaz
5442006a41 Encoding detection in Response.json (#116)
* Use response text on `json`

Pass kwargs to the loads call

* Add failing test demonstrating corner case

* Copy `guess_json_utf` function from requests

* "Fix" type hinting and lint

* Actually add tests_utils.py
2019-07-11 17:14:58 +01:00