Commit Graph

40 Commits

Author SHA1 Message Date
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
Simon K
deb904dd15
remove chunk_size from api docs for iter_lines variants (#2464)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2022-11-29 15:55:38 +00:00
Daniel Holth
aad60a4f12
add [chunk_size] for a?iter_.* methods (#2281)
```
    def iter_bytes(
        self, chunk_size: typing.Optional[int] = None
    ) -> typing.Iterator[bytes]:
```
2022-06-24 14:36:45 +01:00
David Bordeynik
2847869475
fix-1457: URL's full_path -> raw_path from pull #1285 in docs as well (#1458) 2021-02-07 09:33:45 +01:00
Simon Willison
c52e7d212f
Added missing Request __init__ parameters (#1456)
Co-authored-by: Joe <nigelchiang@outlook.com>
2021-02-07 11:48:23 +08:00
Tom Christie
3f51392bea
Add response.next_request (#1334)
* Add response.next_request

* Add response.next_request

* Add response.next_request to the docs
2020-10-01 13:52:03 +01:00
Joe
924fa8c9dc
Add stream docstring (#1200)
* Add stream() docstring

* Update docs
2020-08-20 10:28:28 +01:00
Hugo van Kemenade
d10b7cdc51
Use pycon for Python console code blocks (#1187)
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-08-18 15:17:44 +02:00
Florimond Manca
cb620e67c7
Add Client.auth setter (#1185) 2020-08-17 14:51:52 +02:00
Felix Hildén
f540bd0bcf
Expand client docstrings (#1152)
* Add AsyncClient.aclose to API documentation

* Expand client docstrings
* Add docstrings for all verbs and close methods
* Include parameter merge information and see also

* Update _client.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
2020-08-11 10:08:53 +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
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
Ed Singleton
fc980e7792
Fix Client Docstring and add AsyncClient to API docs (#883)
* Fix docstring of Client

* Add AsyncClient to API docs

* Add AsyncClient to ToC

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-03-28 17:22:10 +01:00
Colin Bounouar
cfe2278096
Document that iter_* methods are synchronous (#807) 2020-02-06 13:40:42 +01:00
Tom Christie
2038919b7e
Proposed 0.11 docs (#727)
* Proposed 0.11 docs

* Add async section and link in

* Update docs/advanced.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/quickstart.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Docs updates

* Use context-managed client instances in examples

* Update README with links to docs site, rather than to .md documents

* "99% test coverage"

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

* Add Client.close method to API docs

* Update docs/async.md

Co-Authored-By: Florimond Manca <florimond.manca@gmail.com>

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2020-01-08 12:51:52 +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
d5da7430a2 Rename 'close' to 'aclose' on Client (#675)
* Switch to aclose on Client

* Fix reference to aclose in API docs
2019-12-29 15:15:09 +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
e30ec85016
Fix out-of-date methods on Response API docs (#673) 2019-12-21 17:21:14 +01:00
Tom Christie
fc95c7e71e
stream -> stream_bytes, raw -> stream_raw (#599) 2019-12-05 11:39:28 +00:00
Tom Christie
206c5372a6
Drop sync (#544)
Drop sync client
2019-11-27 10:43:42 +00:00
Tom Christie
1ce3cc3269 First pass at autodoc support (#464)
* First pass at autodoc support

* Add mkautodoc requirement for docs builds

* Linting

* pip install httpx when building docs, to make it available to mkautodoc

* Fix code example in docstring slightly

* Use latest mkautodoc to resolve rendering of code snippets in docstrings

* Fill in 'Helper functions' API docs

* First pass at documenting Client

* Add autodoc for Client

* Update to mkautodoc 0.1

* Fix typos
2019-10-30 16:21:39 +01:00
Florimond Manca
074cd25b04
Document client block-usage and close() (#487)
* Document client context manager vs close() usage

* Convert client snippets to use context-managed syntax
2019-10-19 13:52:44 +02:00
Davit Tovmasyan
2f2a4e4ef0 Document the files parameter on .post(), .patch(), and .put() (#409) (#414) 2019-10-03 19:47:19 -05:00
Jt Miclat
6752f7d6f6 Remove data, json and files parameters in delete() function (#408) 2019-09-28 12:18:40 -05:00
Tyrel Souza
5dc646fb9f Adding params to Client (#372) 2019-09-23 09:22:21 -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
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
toppk
9e420a5c34 Automatically convert Client.cookies and Client.headers on set (#274) 2019-08-27 19:25:30 -05:00
Seth Michael Larson
e7aa6d6710
Force HTTP/1.1 on short-lived connections (#284) 2019-08-27 07:54:11 -05: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
Stephen Brown II
44beaa1c8f Make Origin use scheme, not is_ssl (#168) 2019-07-28 21:43:06 -05:00
Stephen Brown II
72e6f47897 Allow setting headers at the Client level (#159) 2019-07-28 20:39:35 -05:00
Tom Christie
2d09d5b36c
Renaming -> httpx (#129)
* Renaming -> httpx

* Renaming to httpx
2019-07-19 15:15:16 +01:00
Tom Christie
bb8697011d
Support WSGI and ASGI apps. (#94)
* Add 'Client(app=...)' support

* Add ASGI support with Client(app=app)

* Improve exc cases when using client with ASGI

* Tighten up exception handling when using as a test client

* Fix up stream I/O for WSGI/ASGI apps

* Docs for WSGI/ASGI integration
2019-06-18 15:53:33 +01:00
Tom Christie
56a7943206
Int status codes (#92)
* Use plain int for response.status_code

* Linting
2019-06-17 16:53:39 +01:00
Tom Christie
c9747aa357
http3 (#86)
* Start fleshing out documentation

* Docs work

* http3

* Update docs

* Include lowercase status codes, for requests compat

* Updating docs

* Docs tweaks
2019-06-12 15:02:16 +01:00