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
cdeler
def9f1c320
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>
2020-09-02 13:02:59 +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
Tom Christie
e39a6d9ef4
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>
2020-09-01 22:44:52 +02:00
Tom Christie
cf5970336a
Minor test refactoring ( #1242 )
2020-09-01 22:41:30 +02: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
Tom Christie
33d339a262
Handle multiple auth headers correctly ( #1240 )
...
Handle multiple auth headers correctly
2020-09-01 14:08:10 +01:00
cdeler
fa7661b306
Closing AsyncClient in all tests ( #871 ) ( #1219 )
...
All over the AsyncClient invocation is made using context manager or with try-finally block
2020-08-31 18:02:28 +03:00
Eduardo Enriquez
aad8209928
Replace httpx.URL for str in tests ( #1237 )
...
Co-authored-by: Eduardo Enriquez (eduzen) <eduardo.enriquez@freshbooks.com>
2020-08-30 08:01:37 +02: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
Tom Christie
534400ee42
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>
2020-08-26 12:05:05 +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
19515e8a8b
Fix request auto headers ( #1205 )
...
* Failing test case
* Fix auto_headers in Request.prepare()
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-08-21 12:03:15 +01:00
Joe
03cd88c336
Map httpcore exceptions for Response read methods ( #1190 )
...
* Map httpcore exceptions for `Response.iter_*` methods
* Tweak
* Change wording
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-19 12:10:04 +01:00
Florimond Manca
cb620e67c7
Add Client.auth setter ( #1185 )
2020-08-17 14:51:52 +02:00
Florimond Manca
09c3e90e3b
Add test for HEAD redirect behavior ( #1184 )
2020-08-16 08:12:17 +02:00
Josep Cugat
842ccfafe6
Add exported members test ( #1179 )
...
Taken from https://github.com/encode/httpcore/pull/156
Added as a followup of https://github.com/encode/httpx/pull/1177#issuecomment-674252582
2020-08-15 12:24:26 +02: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
Florimond Manca
a4463d044f
Allow disabling auth per-request using auth=None ( #1115 )
...
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-11 15:18:27 +02: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
8c7729e42c
Version 0.14.0 ( #1083 )
...
* Version 0.14.0
* Update CHANGELOG
* Update CHANGELOG.md
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Update CHANGELOG
* max_keepalive_connections
* Add deprecation test
* Update CHANGELOG.md
* Undate dependency pin callout
* Update expected 1.0 release date
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
2020-08-07 15:50:25 +01:00
Tom Christie
8d9dfb54fc
HTTP/2 becomes fully optional ( #1140 )
...
* HTTP/2 becomes fully optional
* Fix linting, coverage
2020-08-07 15:16:21 +01:00
Tom Christie
876e722b24
Update to httpcore 0.10 ( #1126 )
...
* Keep HTTPError as a base class for .request() and .raise_for_status()
* Updates for httpcore 0.10
* Update httpx/_exceptions.py
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Use httpcore.SimpleByteStream/httpcore.IteratorByteStream
* Use httpcore.PlainByteStream
* Merge master
* Update to httpcore 0.10.x
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
2020-08-07 14:14:11 +01:00
cdeler
0a38695063
Fixed warnings in unit tests suite, caused by #1127 PR ( #1137 )
2020-08-06 13:41:11 +01:00
cdeler
7123b0f7ba
#1066 make BaseClient's timeout accessible using getters and setters ( #1135 )
2020-08-06 12:09:21 +01:00
Tom Christie
0e73be83a8
Deprecate URL.is_ssl ( #1128 )
2020-08-05 19:10:59 +01:00
Tom Christie
a3392c6ea7
Base URL improvements ( #1130 )
...
* URL.join(url=...), not URL.join(relative_url=...)
* Fix URL.join()
* Support no argument 'httpx.URL()' usage
* Support client.base_url as a property
* Resolve base_url joining behaviour
* Fix coverage
* Update _client.py
2020-08-05 18:56:25 +01:00
cdeler
7279ed4658
Raise warning if proxy key is eg. "all" instead of "all://". ( #1127 )
...
* #1105 added deprecation warning, raised when we try to use proxies={"http": ...} instead of {"http://": ...}. Updated docs and added unit, which check the warning presence
* Update tests/client/test_proxies.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update tests/client/test_proxies.py
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-08-05 18:41:50 +01:00
Florimond Manca
78cf16ace9
Drop HSTS Preloading ( #1110 )
...
* Drop HSTS Preloading
* Update test_client.py
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-05 13:05:45 +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
Joe
d76b2c2fb7
Handle bare env proxy hostname gracefully ( #1120 )
2020-08-02 10:48:09 +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
f67e925f72
Rename PoolLimits to Limits ( #1113 )
...
* Rename PoolLimits to Limits
* Lint
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-01 20:44:58 +01:00
Florimond Manca
26cd4f54e8
Switch to more concise Timeout parameters ( #1111 )
...
* Switch to more concise Timeout parameters
* Update docs
* Rename attributes
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-01 19:59:01 +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
Florimond Manca
71d5234305
Rename URLMatcher -> URLPattern ( #1109 )
2020-08-01 11:07:31 +02:00
Tom Christie
9409900898
Exception hierarchy ( #1095 )
...
* Exception heirachy
* Exception heirarchy
* Formatting tweaks
* Update httpx/_exceptions.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_exceptions.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_exceptions.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_exceptions.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-31 12:57:49 +01: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
dba83d45a5
httpx.Timeout must include a default ( #1085 )
...
* httpx.Timeout must include a default
* Tweak docstring
* Gentle deprecation for mandatory default on httpx.Timeout(...)
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-31 11:41:53 +01:00
Tom Christie
16893e414f
Add support for no-proxy configurations ( #1099 )
...
* Add internal URLMatcher class
* Use URLMatcher for proxy lookups in transport_for_url
* Docstring
* Pin pytest
* Add support for no-proxies configurations
2020-07-31 10:21:11 +01: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
Can Sarıgöl
926a55a84f
Included create_ssl_context function to create the same context with SSLConfig and serve as API ( #996 )
...
* Included create_ssl_context function to create the same context with SSLConfig and serve as API.
* Changed create_ssl_context with SSLConfig into the client implementation and tests.
* Dropped the __repr__ and __eq__ methods from SSLConfig and removed SSLConfig using from tests
* Fixed test issue regarding cert_authority trust of ssl context
Co-authored-by: Tom Christie <tom@tomchristie.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-27 19:46:46 +01:00
Tom Christie
35f09d1394
Single consistent name for status codes ( #1088 )
...
* Single consistent name for status codes
* Gentle deprecation for httpx.StatusCode
2020-07-27 14:35:01 +01:00
Tom Christie
2d491c9e7d
Full coverage, with exception of URLLib3Transport ( #1086 )
2020-07-24 15:24:06 +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
696c1eff03
Parameterize invalid URL tests ( #1079 )
2020-07-23 10:40:00 +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
20f4911e80
Fixes for LineDecoding ( #1075 )
...
* Fixes #1033 - Ensure that text that spans 3 invocations before newline is handled - don't clobber the buffer between invocations that haven't seen any lines.
This seems like a one character fix + the test.
* Update the tests.
* Undo formatting/indentation.
* Update long comment.
* Fix trailing cr line decoding
Co-authored-by: Sheridan C Rawlins <scr@verizonmedia.com>
2020-07-23 09:45:35 +01:00
Tom Christie
8ed7e52a37
Drop fullpath setter ( #1069 )
2020-07-23 09:43:11 +01:00
François Voron
0641606619
Skip HSTS preloading on single-label domains ( #1074 )
...
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-07-21 10:40:10 +01:00
Sheridan C Rawlins
ad5e6eb8b0
Fixes #1033 - Ensure that text that spans 3 invocations before newline is handled - don't clobber the buffer between invocations that haven't seen any lines. ( #1034 )
...
Fixes #1033 - Ensure that text that spans 3 invocations before newline is handled - don't clobber the buffer between invocations that haven't seen any lines.
2020-07-21 10:33:45 +01:00
François Voron
27b0dbc22d
Raise HTTPStatusError in raise_from_status ( #1072 )
2020-07-20 13:10:57 +01:00
Tom Christie
a89d4ad625
More public API tightening ( #1065 )
2020-07-17 11:19:24 +01:00
Tom Christie
e107e0f842
Tighten public client methods ( #997 )
...
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-17 10:20:52 +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
Tom Christie
ff93a011a4
Support QueryParams(None) ( #1060 )
2020-07-16 11:16:29 +01:00
Tom Christie
3f96e74961
Drop deprecated API ( #1057 )
...
* Drop ASGIDispatch, WSGIDispatch, which has been replaced by ASGITransport, WSGITransport.
* Drop dispatch=... on client, which has been replaced by transport=...
* Drop soft_limit, hard_limit, which have been replaced by max_keepalive and max_connections.
* Drop Response.stream and Response.raw, which have been replaced by aiter_bytes and aiter_raw.
* Drop internal usage of as_network_error in favour of map_exceptions.
2020-07-15 12:19:56 +01:00
Florimond Manca
0296c2bbb9
Type check tests ( #1054 )
2020-07-07 11:10:43 +02:00
Florimond Manca
3230cb3133
Add missing Response.next() ( #1055 )
2020-07-07 10:54:50 +02:00
Taneli Hukkinen
6a20cfc0b8
Simplify bytes to hex string conversion ( #1049 )
...
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-05 12:16:55 +02:00
Florimond Manca
bacc2d1835
Map HTTPCore exceptions ( #1044 )
...
* Map HTTPCore exceptions
* Expose new TimeoutException
2020-07-03 15:56:10 +02:00
Florimond Manca
fab427972b
Add exceptions missing from top-level package ( #1045 )
...
* Expose missing exceptions: CloseError, ConnectError, ReadError, WriteError
* Lint
2020-07-03 15:18:24 +02:00
Taneli Hukkinen
6cf9039593
Improve list/dict comprehensions ( #1036 )
...
* Improve list/dict comprehensions
* Dont make needless list() conversions before bytes.join()
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-07-02 17:45:00 +02:00
euri10
4d287956fd
Add support for multiple files per POST field ( #1032 )
...
* Changed RequestFiles type
* Changed RequestFiles type 2
* Added test for multiple files same field
* Lint
* Mypy no idea
* Added doc
* Fixed some docs typos
* Checking the right instance type and deleting the mypy ignore
* Docs clarification
* Back on images form field, with other files modified
2020-06-24 19:17:27 +02:00
Florimond Manca
838f417ce0
Run ASGI tests on trio too ( #1020 )
2020-06-13 19:42:36 +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
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
Josep Cugat
89a8100b6c
Replace remaining occurrences of dispatch with transport ( #1010 )
...
* Replace remaining occurrences of dispatch with transport
* Remove unused AsyncDispatcher
Was removed in #804
* Remove hard_limit warning in test
2020-05-30 23:18:48 +02:00
Josep Cugat
093cb42500
Improve error when redirecting with custom schemes ( #1002 )
...
Fixes #822
2020-05-28 13:11:17 +02:00
Hasan Ramezani
21d7e16559
Fixed mypy errors in test_async_client.py and test_client.py ( #985 )
2020-05-27 21:29:52 +02:00
Tom Christie
7c8158a852
Add "Content-Length: 0" on POST, PUT, PATCH if required. ( #995 )
...
* Add Content-Length: 0 on POST, PUT, PATCH if required.
* Update tests/client/test_client.py
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-05-26 15:03:55 +01:00
Florimond Manca
440b5ab95f
Remove unused concurrency test utils ( #989 )
2020-05-24 11:38:24 +02:00
Florimond Manca
ab9ace2749
Fix bytes support in multipart uploads ( #974 )
2020-05-21 16:25:31 +02:00
Tom Christie
991915a935
Rename pool limit options ( #968 )
...
* Pass proxy_url
* Rename hard_limit/soft_limit
* Use 'warn_deprecated' function
* Update PoolLimits docs
* Linting
* Update httpcore dependancy
* Update port in Transport API to be 'Optional[int]'
2020-05-21 13:26:20 +01:00
Yeray Diaz Diaz
d2816c9c48
Transport API ( #963 )
...
* Deprecate Client arg 'dispatch' and use 'transport'
* Remove line in test from coverage
* Document custom transports
* _dispatch > _transports
Also rename *Dispatch classes to *Transport and added aliases
* Fix linting issues
* Missed one _transports import
* Promote URLLib3Transport to public API
* Remove duplicate arg doc
* Assert that urllib3 is imported to use URLLib3Transport
* `AsyncClient`, not asynchronous `Client`
* Add warning category to warn calls
* Update docs/advanced.md
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
* Add warn_deprecated utility function
* Amend docs references to dispatch
* Add concrete implementation example
* Clearer transport implementation description
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-05-21 12:22:17 +01:00
Tom Christie
d6b3794395
Attempt to resolve test flakiness ( #946 )
2020-05-12 16:02:25 +01:00
Jamie Hewland
d568ecda53
ASGI: Wait for response to complete before sending disconnect message ( #919 )
...
* asgi: Wait for response to complete before sending disconnect message
* Dial back type checking + remove concurrency module
* Remove somewhat redundant comment
2020-05-12 10:06:53 +01:00
Jamie Hewland
8710079d5d
asgi: Send http.disconnect message on receive() after response complete ( #909 )
...
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-05-01 11:51:35 +02:00
Florimond Manca
5829ecb648
Implement streaming multipart uploads ( #857 )
...
* Implement streaming multipart uploads
* Tweak seekable check
* Don't handle duplicate computation yet
* Add memory test for multipart streaming
* Lint
* 1 pct is enough
* Tweak lazy computations, fallback to non-streaming for broken filelikes
* Reduce diff size
* Drop memory test
* Cleanup
2020-04-10 20:40:04 +02:00
Florimond Manca
af75908b7a
Drop concurrency backends ( #901 )
...
* Drop concurrency backends
* Put back as_network_error for use in urllib3 dispatcher
2020-04-10 18:48:01 +02: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
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
Ed Singleton
94323f98ac
Fix support for generator-based WSGI apps ( #887 )
...
* Handle generator WSGI app
* Lint code
* Add type annotations
* Add more tests
* Refactor test to use application_factory
* Remove content length as it's misleading
* Add test for WSGI generator
* Add test for empty generator
* Remove previous tests
* Move docstring to a comment
* Fix whitespace
* Fix name of function
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* Update tests/test_wsgi.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* Update tests/test_wsgi.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* Update httpx/_dispatch/wsgi.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-03-29 13:13:01 +02:00
Dima Boger
939f3ce7ce
Add content-length header for empty bytestream ( #866 )
...
Also, fixed related tests
2020-03-28 16:05:06 +01:00
Dima Boger
430285f55b
Fix multipart edge cases with data={} and/or files={} ( #861 )
...
* Add reproducible test example for empty multipart
* Possible fix for empty combination of files/data
* Return bytestream with empty data/files
* Remove content-length in test
Co-authored-by: florimondmanca <florimond.manca@gmail.com>
2020-03-16 22:34:50 +01:00
Evan Lurvey
707e54c484
Enable NO_PROXY environment variable support ( #835 )
...
* Enabling NO_PROXY env support
* Enabling NO_PROXY env var support and writing tests
* Update tests/client/test_proxies.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* Update tests/client/test_proxies.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-03-02 16:51:34 +01:00
Tom Christie
3333152b54
Don't support broken dict-of-dicts case for data argument ( #811 )
2020-03-02 10:34:04 +00:00
Florimond Manca
53804173bb
Drop backend parameter on AsyncClient ( #791 )
...
* Drop backend parameter on AsyncClient
* Fix master merge
Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-02-27 20:42:18 +00:00
Piotr Staroszczyk
efe9f61bc2
Drop RedirectLoop exception ( #819 )
...
* drop RedirectLoop exception
* tests is package to allow run it easly
* bring back test for redirect loop
2020-02-24 10:09:52 +00:00
George Kettleborough
b3db9ff0b6
Add Auth.requires_response_body attribute ( #803 )
...
* Add Auth.requires_response_body attribute
If set then responses are read by the client before being sent back into the auth flow
* Update tests and docs
* PR fixes
* Change example methods
2020-02-10 12:10:11 +00: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
Tim Gates
c2eb0bd40f
Fix simple typo: conncurrent -> concurrent ( #793 )
...
Closes #792
2020-01-26 01:24:41 -05:00
Yeray Diaz Diaz
b23420392e
Detect credentials in proxy URLs and create Proxy-authorization header ( #780 )
...
* Detect auth in proxy URLs and create Proxy-authorization header
* Add credentials and SOCKS details to proxy documentation
* Use URL.copy_with to remove credentials from URL
2020-01-20 13:50:50 +00:00
Tom Christie
1f8fb28d93
Handle redirect with malformed Location headers missing host. ( #774 )
2020-01-17 11:42:51 +00:00
Tom Christie
5a63540e8a
Fix for streaming a redirect response body with allow_redirects=False ( #766 )
2020-01-17 09:45:37 +00:00
Tom Christie
780d1843ca
Support both zlib and deflate encodings ( #758 )
...
* Support both zlib and deflate encodings
* Helpful test docstrings
2020-01-14 09:00:52 +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
f17ab37b2f
Prep for introducing SyncClient ( #713 )
...
* Reorganize method ordering in client
* Move 'request'
* Use 'httpx.Proxy' for proxy configuration
2020-01-07 10:27:01 +00:00
Tom Christie
e19bd9bc4b
Dispatcher -> AsyncDispatcher ( #725 )
...
* Dispatcher -> AsyncDispatcher
* Fix invalid renamings
* Fix invalid renamings
2020-01-06 12:08:14 +00:00
Tom Christie
6ac49dacdd
Drop run and run_in_threadpool ( #710 )
...
* Drop run and run_in_threadpool
* Fix server restart errors
* Re-introduce 'sleep' as a concurrency test utility
* Simpler test concurrency utils
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-01-06 11:14:43 +00:00
Florimond Manca
bd57b650a8
Release max_connections for keepalive connections when closing the connection pool ( #721 )
2020-01-06 11:13:06 +00:00
Kousik Mitra
0ed0314569
Raise an exception in DigestAuth if non-replayable request is passed ( #685 )
...
* DigestAuth will raise exception if non-replayble request is passed #670
* Added new exception RequestBodyUnavailble exception to raise non replayable request error #670
* Changed RedirectBodyUnavailable exception to RequestBodyUnavailble to raise non-replayable exception #670
* fixed class declaration
* Added RequestBodyUnavailable exception. Imported it in module level
* Added RequestBodyUnavailable in the module list
* Code reformat
* Added Test to check if exception is raising if non-replayble request body is passed to DigestAuth #670
2020-01-04 10:00:34 +01:00
Florimond Manca
bc6163c55a
Record history of requests made during authentication ( #718 )
...
* Record history of requests made during authentication
* Add asserts on digest auth history
Co-Authored-By: Gaurav Dhameeja <gdhameeja@gmail.com>
2020-01-03 22:59:16 +01:00
Florimond Manca
910aa9094c
Repurpose RedirectBodyUnavailable as RequestBodyUnavailable ( #690 )
2020-01-03 22:25:55 +01:00
Tom Christie
79a9748ae6
Load SSL Context on init ( #709 )
2020-01-02 16:52:23 +00:00
Tom Christie
f5eaec7ab3
More coverage improvements ( #711 )
...
* More coverage improvements
* Drop redundant 'sleep' usage in test utils
2020-01-02 15:33:26 +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
b0bf2a7513
SSLConfig refactor ( #706 )
...
* SSLConfig includes 'http2' argument on init.
* Pass SSL config to HTTPConnection as a single argument
* Don't run SSL context loading in threadpool
2020-01-02 10:54:04 +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
Gabriel Strauss
de8b95533d
Adds check to enforce single consumption of AsyncIteratorStream. ( #697 )
2019-12-31 12:01:43 +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
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
Florimond Manca
3462999366
Rename 'next' to 'anext' on Response ( #676 )
...
* Rename 'next' to 'anext' on Response
* Drop iscoroutinefunction() check
Co-authored-by: Tom Christie <tom@tomchristie.com>
2019-12-29 15:34:07 +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
e9ebd1df98
Drop per-request cert, verify, and trust_env ( #617 )
...
* Drop per-request cert/verify/trust_env
* Remove cert/verify from the dispatcher API
* Apply lint
* Reintroduce cert/verify/trust_env on client methods, with errors
2019-12-29 15:01:20 +00:00
Florimond Manca
0ee0005154
Type-check test_cookies.py ( #677 )
2019-12-23 10:51:06 +01:00
Florimond Manca
49e4d155ee
Type-check test_auth.py ( #665 )
...
* Type-check test_auth.py
* Drop request cast
2019-12-21 18:48:55 +01:00
Florimond Manca
d0427bead0
Clean up 'backend' fixture ( #664 )
...
* Clean up 'backend' fixture
* Add docstring to 'async_environment' fixture
2019-12-21 16:08:40 +01: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
Andrés Álvarez
e34df7a7a1
Rename concurrency directory to backends ( #662 )
...
Closes #659
2019-12-20 16:53:42 +00: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
6c69e0936b
No I/O auth ( #644 )
...
* No I/O on Auth
2019-12-18 15:25:31 +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
52c2c9762f
Bump up flow control defaults ( #629 )
...
* Bump up flow control defaults
* Linting
* Simplify mock HTTP/2 stream in tests
2019-12-12 11:57:53 +00:00
Tom Christie
499de51f2b
Keep-alive timeouts. ( #627 )
...
* Add .time() to backend
* Add connection timeouts
* Add test case for keep alive timeouts
* Update httpx/dispatch/connection_pool.py
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* Cleanups from review
* Use .expires_at, rather than .timeout_at
2019-12-12 11:52:49 +00:00
Tom Christie
02d16bfb34
Trivial-case test for response.elapsed
2019-12-09 17:12:20 +00:00
Tom Christie
3124a38123
Minor config cleanup ( #621 )
2019-12-09 10:59:55 +00:00
Tom Christie
eba29da632
Drop 'fork' ( #619 )
2019-12-08 19:52:46 +00:00
Florimond Manca
ab41a5d5c3
Refactor tests in the light of backend auto-detection ( #615 )
...
* Refactor tests in the light of backend auto-detection
* Test passing explicit backend separately
* Drop 'backend=backend'
* Fix usage of asyncio.run() on 3.6
2019-12-07 15:17:35 +01:00
Tom Christie
bc54dd0399
Backend operations like .read(), .write() now have a manadatory timeout argument. ( #611 )
2019-12-07 11:09:58 +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
Florimond Manca
c38fd68ed7
Drop BackgroundManager in favor of fork(func1, func2) ( #603 )
...
* Drop BackgroundManager in favor of fork(func1, func2)
* Please mypy
2019-12-06 10:49:24 +00:00
Tom Christie
8d8ea8bbba
Add Client.stream() method. ( #600 )
...
* Add Client.stream() method.
* Add top-level stream API
* Documentation
2019-12-05 17:25:43 +00:00
Tom Christie
fc95c7e71e
stream -> stream_bytes, raw -> stream_raw ( #599 )
2019-12-05 11:39:28 +00:00
Tom Christie
dad379736d
Fix Timeout -> TimeoutException in test case ( #598 )
2019-12-05 11:03:27 +00:00
Tom Christie
2f54b200de
Allow default+override timeout style ( #593 )
...
* Allow styles like: httpx.Timeout(5.0, pool_timeout=None)
* Update timeout docs
* Minor tweaks to sub headings in timeout docs
* Fixing up Timeout docs
* RequestTimeout -> TimeoutException
* Tweak timeout docs
2019-12-05 09:38:48 +00:00
Tom Christie
eb7c6b0342
Differentiate between timeout=None and timeout=UNSET. ( #592 )
...
* TimeoutConfig -> Timeout
* Timeout=None should mean what it says.
* Drop optional timeout on internal client methods
2019-12-04 11:54:39 +00:00
Tom Christie
c033ed1b65
TimeoutConfig -> Timeout ( #591 )
2019-12-04 11:39:45 +00:00
Tom Christie
5076952202
Rename http2 switch ( #586 )
...
* Simplify HTTP version config, and switch HTTP/2 off by default
* HTTP/2 docs
* HTTP/2 interlinking in docs
* Add concurrency auto-detection
* Add sniffio
* Rename HTTP2 switch on client
* http_2 -> http2
2019-12-02 19:52:29 +00:00
Tom Christie
3cbe7315e8
Concurrency autodetection ( #585 )
...
* Simplify HTTP version config, and switch HTTP/2 off by default
* HTTP/2 docs
* HTTP/2 interlinking in docs
* Add concurrency auto-detection
* Add sniffio
2019-12-02 19:26:16 +00:00
Tom Christie
30229f1652
Better HTTP/2 defaults. ( #584 )
...
* Simplify HTTP version config, and switch HTTP/2 off by default
* HTTP/2 docs
* HTTP/2 interlinking in docs
2019-12-02 17:07:04 +00:00
Tom Christie
12d00b238e
Minor test fixes ( #583 )
...
* Minor test fixes
* Fix multipart test to less ambiguous file extension -> mime type check
* Include a no-file-extension case in multipart tests
2019-12-02 12:11:15 +00:00
Mattwmaster58
ed949508a6
Files without a filename should not set a Content-Type in multipart data. ( #520 )
...
* File upoads with no filename should not set a Content-Type in their multipart data.
* Update type annotations to allow file uploads to be a string
2019-11-30 19:46:44 +00:00
Tom Christie
248aa580a1
Add Response.stream_lines ( #575 )
2019-11-30 18:02:46 +00:00
Tom Christie
fdaa01275a
Add Response.is_error ( #574 )
2019-11-30 17:43:48 +00:00
Casey
9df76ccfe9
Preserve list type query paramaters when merging QueryParams objects ( #546 ) ( #547 )
2019-11-30 15:35:09 +00:00
Tom Christie
43331cfb3d
Ensure Authorization header has priority over .netrc
2019-11-30 12:06:16 +00:00
Florimond Manca
3218c35341
Refactor start_tls tests ( #567 )
...
* Refactor start_tls tests
* Clean up read_response()
2019-11-29 22:16:32 +01:00
Tom Christie
364378a814
Pool timeouts should be on the TimeoutConfig, not PoolLimits ( #563 )
...
* Pool timeouts should be on the TimeoutConfig, not PoolLimits
* Linting
* Fix type annotation
* Linting
2019-11-29 12:01:51 +00:00
Tom Christie
e045b86d7f
Clean up '_dispatcher_for_request' into 'dispatcher_for_url' ( #561 )
2019-11-29 11:21:40 +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
a05ba2e914
Fix race condition on stream.read ( #535 )
...
* Fix race condition on stream.read
* Refactor run_concurrently
2019-11-22 09:34:09 +01:00
toppk
f06ca87f97
Handle h11.Connection.next_event() RemoteProtocolError ( #524 )
...
raise (new) ConnectionClosed exception if this occurs when
socket is closed, otherwise reuse ProtocolError exception.
Add test case for ConnectionClosed behavior.
Resolves #96
2019-11-22 09:33:40 +01:00
Jonas Lundberg
7a96a2c896
Add support for unix domain sockets ( #511 )
...
* Add and implement open_uds_stream in concurrency backends
* Add uds arg to BaseClient and select tcp or uds in HttpConnection
* Make open stream methods in backends more explicit
* Close sentence
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
* Refactor uds concurrency test
* Remove redundant uds test assertions
2019-11-19 23:02:08 +01:00
Seth Michael Larson
331be99cbf
Add support for proxy tunnels for Python 3.6 + asyncio. ( #521 )
...
* Backport start_tls() support for Python 3.6
* Remove version check in start_tls test
2019-11-17 12:50:54 +01:00
Tom Christie
5aca0c0172
Fix redirect cookie behavior ( #529 )
...
* Fix redirect cookie behavior
* Drop flake8-comprehensions
* Add redirect cookie tests
2019-11-15 21:31:15 +00:00
Jonas Lundberg
1a32cf036a
Rename BaseTCPStream/TCPStream to BaseSocketStream/SocketStream ( #517 )
2019-11-08 17:09:38 +01:00
Florimond Manca
586acddd1a
Improve robustness of live HTTP/2 test ( #512 )
2019-11-08 00:35:34 +01: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
Florimond Manca
e3140a0803
Reorganize timeout config tests ( #491 )
2019-10-22 22:04:42 +02:00
Jamie Hewland
88d73de752
asyncio: Wait for the stream to close when closing ( #494 )
2019-10-22 22:01:40 +02:00
Yeray Diaz Diaz
9ec2cfc5dc
Multipart files tweaks ( #482 )
...
* Allow filenames as None in multipart encoding
* Allow str file contents in multipart encode
* Some formatting changes on `advanced.md`
* Document multipart file encoding in the advanced docs
* Update docs/advanced.md
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
2019-10-20 13:25:00 +01:00
Jamie Hewland
644e8fc5b6
Make start_tls a method on streams & return a new stream ( #484 )
...
* Move start_tls to stream & return a new stream
* asyncio: Keep a reference to the inner stream when upgrading to TLS
2019-10-20 12:59:16 +02: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
38a136833f
Add start_tls to Trio backend ( #467 )
2019-10-10 07:01:23 -05:00
Florimond Manca
57ae7ea22b
Allow lists in query params ( #386 )
2019-10-08 15:12:04 -05:00
Florimond Manca
fc3df514e8
Don't check trio import in definition of backend fixture params ( #447 )
2019-10-05 19:12:06 -05:00
Florimond Manca
24346e2039
Fix flaky Response.elapsed tests ( #446 )
2019-10-04 15:36:06 -05:00
Can Sarıgöl
dd3fbcc8d7
Don't include username/password components in Host header ( #417 )
...
* removed auth and port from host of header
* used URL attribute rather _uri_reference
* reverted removing port into host
* reverted username and password from header
* applied new copy_with with username and password
2019-10-04 10:33:18 +01:00
Can Sarıgöl
e6da325e8b
added authority copy feature in URL.copy_with ( #436 )
2019-10-04 09:17:25 +01:00
Josep Cugat
86a0eb0268
Revert "Use Python 3.8 asyncio.Stream where possible ( #369 )" ( #423 )
...
This reverts commit 71cbde8ba4 .
2019-10-03 09:18:10 +01:00
Josep Cugat
a0282569d5
Make HTTPError importable from the top-level ( #421 )
2019-10-01 13:37:05 -05:00
Stephen Brown II
db3e3a0231
Add flake8-pie plugin ( #419 )
2019-10-01 12:02:29 -05:00
Seth Michael Larson
05f5dc26de
Get test suite back to ~100% line coverage ( #406 )
2019-09-29 13:58:22 -05:00
Jamie Hewland
71cbde8ba4
Use Python 3.8 asyncio.Stream where possible ( #369 )
2019-09-28 12:23:14 -05:00
Seth Michael Larson
336d22d73a
Propogate HTTPProxy config from Client( #377 )
2019-09-25 07:17:20 -05:00
Florimond Manca
cadb9a4d4c
Fix bug when using client without timeouts in Python 3.6 ( #383 )
2019-09-25 06:31: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
Tyrel Souza
5dc646fb9f
Adding params to Client ( #372 )
2019-09-23 09:22:21 -05:00
Seth Michael Larson
b574230f90
Remove ENABLE_CONNECT_PROTOCOL from HTTP/2 Settings ( #373 )
2019-09-22 17:37:57 -05:00
Florimond Manca
08355c62f5
Add trio concurrency backend ( #276 )
2019-09-21 11:10:20 -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
Jamie Hewland
338a360785
Use a certificate issued from the trustme CA in tests ( #357 )
2019-09-18 18:59:27 -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
Yeray Diaz Diaz
8155352d20
Document digest auth ( #348 )
...
* Document authentication
* Fix linting errors
* Tweak wording
* Update docs/quickstart.md
Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>
2019-09-16 12:50:00 +01:00
Florimond Manca
6c6148ec5c
Fix remaining references to BaseStream in tests ( #347 )
2019-09-16 08:34:26 +02:00
Florimond Manca
315a18b4cf
Stream -> TCPStream ( #339 )
2019-09-15 16:14:48 -05:00
Seth Michael Larson
57c27cac36
Implement HTTPProxy dispatcher ( #259 )
2019-09-15 10:47:35 -05:00
Florimond Manca
f1dde95d35
Test Requests entrypoints ( #330 )
...
* Test Requests entrypoints
* Show summary of unsuccessful tests
2019-09-12 23:24:33 +02:00
Yeray Diaz Diaz
1cd9156d5d
Additional DigestAuth tests ( #334 )
2019-09-11 07:25:11 -05:00
Yeray Diaz Diaz
fd3b69d2aa
Add DigestAuth middleware ( #332 )
...
* Remove global variable, just return response from auth request
* Add extra space to Digest header start assertion
* Prevent unpacking errors limiting the number of splits
2019-09-10 14:53:39 -05:00
Dobrovolsky Bogdan
08edfac37d
Add build_request to Client ( #319 )
...
* Update documentation
* Update documentation
* Update tests
Rename `_send` -> `_get_response`
Update documentation
* Code format with black
* Change documentation example to OPTIONS *
* Update documentation
Small code reformat
* `echo_headers` return json
* Simplify test
* Fix typo
2019-09-08 08:03:59 -05:00
Gaurav Dhameeja
0f34f3b60f
Raise KeyError if header isn't found in Headers ( #324 )
2019-09-07 16:12:37 -05:00
IsaacBenghiat
ab9cd0ea11
Fix bug in calculating maximum frame size ( #153 )
2019-09-06 13:06:20 -05:00
Tom Christie
33c5fe0374
Merge pull request #310 from encode/drop-content-length-on-get-redirects
...
Drop Content-Length headers on GET redirects
2019-09-05 10:21:21 +01:00
Tom Christie
5961bd8ba3
Apply black formatting
2019-09-04 15:11:40 +01:00
Tom Christie
4336550d22
Add tests for dropping Content-Length headers
2019-09-04 15:06:14 +01:00
Yeray Diaz Diaz
fa74aaa6db
Add test for origin from URL string ( #312 )
2019-09-04 13:43:24 +02:00
Seth Michael Larson
b8c5e7a852
Add os.environ fixture ( #308 )
2019-09-02 23:12:52 +02:00
Florimond Manca
40e6e8c99d
Refactor client functionality into middleware ( #268 )
...
Co-authored-by: yeraydiazdiaz <yeraydiazdiaz@gmail.com>
* Dispatcher middlewares
* Redirect and BasicAuth dispatchers
* Remove HTTPBasicAuth and reinstate trust_env logic
* Call resolve dispatcher correctly
* Fix redirection tests
* Add basic and custom auth dispatchers
* Reinstate extracting cookies from response
* Fix linting
* Refactor middleware interface
2019-09-01 23:01:14 +02:00
Tomás Farías
db7f2d0df3
Add support for SSLKEYLOGFILE ( #301 )
...
* Skip test if OpenSSL version is lower than 1.1.1
* Use bionic dist for Python 3.8 job
* Pass trust_env to SSLConfig use monkeypatch in testing
* Don't raise KeyError if SSLKEYLOGFILE is not set
* Move trust_env after verify and cert
2019-09-01 08:01:11 -05: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
Florimond Manca
a46462764e
Tighten up response.next() ( #297 )
2019-08-31 09:09:35 -05:00
Florimond Manca
994403bec9
Serve test server in thread ( #292 )
2019-08-29 23:17:14 +02:00
Min ho Kim
e9b20995f7
Fix typos in comments ( #294 )
2019-08-29 19:14:15 +02:00
toppk
9e420a5c34
Automatically convert Client.cookies and Client.headers on set ( #274 )
2019-08-27 19:25:30 -05: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
Seth Michael Larson
e7aa6d6710
Force HTTP/1.1 on short-lived connections ( #284 )
2019-08-27 07:54:11 -05:00
Florimond Manca
3674058ff7
Parametrize tests with concurrency backend ( #273 )
...
* Parametrize tests with concurrency backend
* Refactor server restart
* Add no-backend test
2019-08-25 20:25:18 +02:00
Seth Michael Larson
1872ae873b
Add ConcurrencyBackend.start_tls() ( #263 )
2019-08-24 10:04:14 -05:00
Florimond Manca
a4b93b91c0
Add missing async test cases ( #269 )
2019-08-23 07:04:21 -05:00
florimondmanca
fdb13592c9
Encapsulate http_version into BaseStream
2019-08-21 09:12:01 +02:00
florimondmanca
14eb81f72d
Unify BaseReader and BaseWriter as BaseStream
2019-08-21 09:02:54 +02:00
Can Sarıgöl
4ea4af661d
Raise TypeError if invalid parameter for HTTPVersionConfig ( #253 )
2019-08-20 17:39:05 -05:00
Tom Christie
e0b523dd1b
Merge pull request #241 from encode/protocol-support
...
Allow configuration of supported HTTP protocol versions.
2019-08-20 15:16:28 +01:00
Tom Christie
e69ee77843
Drop Protocol str enum class in favor of plain old strings ( #251 )
...
* Drop Protocol str enum class in favor of plain old strings
* Drop unused import
2019-08-20 15:15:53 +01:00
Tom Christie
c1ec1c33cd
Response.protocol -> Response.http_version ( #250 )
...
* Response.protocol -> Response.http_version
* Update docs
2019-08-20 15:15:38 +01:00
Tom Christie
dfbfa7c7ec
Drop Protocol str enum class in favor of plain old strings
2019-08-20 14:17:26 +01:00
Tom Christie
b343ee4a70
Add Client(http_versions=...) support
2019-08-20 13:30:54 +01:00
Tom Christie
a770102fd2
Added http_versions to dispatch interface
2019-08-20 12:56:19 +01:00
Tom Christie
fc27fd2530
Test coverage for HTTPVersionConfig
2019-08-20 12:33:28 +01:00
Tom Christie
f72fa68802
'Protocols' -> 'HTTPVersions'
2019-08-20 12:21:07 +01:00
Tom Christie
cf098f8f4c
Merge branch 'protocol-support' of https://github.com/encode/httpx into protocol-support
2019-08-20 12:03:55 +01:00
Can Sarıgöl
a0aff8d169
fixed __repr__ function of Headers and Url classes ( #222 )
2019-08-20 11:48:28 +01:00
Tom Christie
0e49f23b75
Initial pass at configuring supported protocol versions
2019-08-19 20:13:37 +01:00
Can Sarıgöl
79425b28d0
added control to calling decode for empty contents ( #237 )
...
* added tests for all decoder
* fixed BrotliDecoder for b"" value
2019-08-19 16:12:00 +01:00
Ordanis Sanchez
a960a2a8fd
Release semaphore if connection is dropped ( #230 )
2019-08-18 14:44:24 -05:00
Florimond Manca
9c7d23ce29
Enforce that sync client uses asyncio-based backend ( #232 )
2019-08-18 09:41:37 -05:00
Can Sarıgöl
04d5ffb01b
Add trust_env property to BaseClient ( #187 )
2019-08-17 10:09:49 -05:00
Saugat Pachhai
3451028251
Fix typos in docstrings
2019-08-17 09:07:57 -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
Seth Michael Larson
df8874b733
Accept SSLContext into SSLConfig(verify=...) ( #215 )
2019-08-14 22:30:02 -05:00
Seth Michael Larson
af907e85e1
Implement Response.stream_text() ( #183 )
2019-08-14 21:56:17 -05:00
Can Sarıgöl
9536b76f5c
Fail unit tests without 100% coverage ( #206 )
2019-08-14 21:45:28 -05:00