Commit Graph

20 Commits

Author SHA1 Message Date
Tom Christie
8e36f2bc68
Introduce new SSLContext API & escalate deprecations. (#3319)
Co-authored-by: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com>
Co-authored-by: T-256 <132141463+T-256@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-10-28 14:30:08 +00:00
Tom Christie
cabd1c095e
Deprecate app=... in favor of explicit WSGITransport/ASGITransport. (#3050)
* Deprecate app=... in favour of explicit WSGITransport/ASGITransport

* Linting

* Linting

* Update WSGITransport and ASGITransport docs

* Deprecate app

* Drop deprecation tests

* Add CHANGELOG

* Deprecate 'app=...' shortcut, rather than removing it.

* Update CHANGELOG

* Fix test_asgi.test_deprecated_shortcut
2024-02-02 13:29:41 +00:00
Kar Petrosyan
371b6e946c
Use __future__.annotations (#3068)
* Switch to new typing style

* lint
2024-01-24 14:30:22 +00:00
Peter Lazorchak
abb994c0c2
Ensure all WSGITransport environs have a SERVER_PROTOCOL (#2708) 2023-05-19 11:38:18 +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
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
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
Adrian Garcia Badaracco
0b4a83257b
BUG: wsgi.error should be TextIO, not BytesIO in WSGI transport (#1828)
* wsgi.error should be StringIO, not BytesIO

Based on the documentation at https://modwsgi.readthedocs.io/en/master/user-guides/debugging-techniques.html#apache-error-log-files

* Default to sys.stderr and add test

* rename log_file param to wsgi_errors

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-09-07 15:44:35 +01:00
Stanis Trendelenburg
0d3fcc74a5
Close WSGI iterable when WSGIByteStream is closed (#1830)
* Make test fail when WSGI iterable is not closed

* Close WSGI iterable when WSGIByteStream is closed
2021-09-01 16:21:01 +01:00
Aber
02a692aba5
Handle default ports in WSGITransport (#1469)
* Maybe port is `None`

https://www.python.org/dev/peps/pep-3333/#environ-variables

> SERVER_NAME, SERVER_PORT
> When HTTP_HOST is not set, these variables can be combined to determine a default. See the URL Reconstruction section below for more detail. SERVER_NAME and SERVER_PORT are required strings and must never be empty.

* Add unit test

* Compute default port

Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
2021-02-16 13:33:17 +01:00
Tom Christie
feb404f86b
Seperate content=... and data=... parameters (#1266)
* Seperate content=... and data=... parameters

* Update compatibility.md
2020-09-15 13:36:10 +01: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
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
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
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
206c5372a6
Drop sync (#544)
Drop sync client
2019-11-27 10:43:42 +00:00
Tom Christie
2d09d5b36c
Renaming -> httpx (#129)
* Renaming -> httpx

* Renaming to httpx
2019-07-19 15:15:16 +01:00
Seth Michael Larson
c1044cab84 Start using flake8, fix lint issues (#126) 2019-07-18 11:41:50 +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