diff --git a/docs/index.md b/docs/index.md index ab3c22e..53ecdfe 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,25 +2,31 @@ HTTPX

-

HTTPX 1.0 — Design proposal.

+

HTTPX 1.0 — Prelease.

--- -*The following is a design proposal and is not yet fully functional. The work is well underway, tho be aware that some parts of the codebase are still under development.* +A complete HTTP toolkit for Python. Supporting both client & server, and available in either sync or async flavors. --- -A complete HTTP framework for Python. - *Installation...* -```shell -$ pip install git+https://github.com/encode/httpnext.git +
httpx
+ +```{ .shell .httpx } +$ pip install --pre httpx +``` + +```{ .shell .ahttpx .hidden } +$ pip install --pre ahttpx ``` *Making requests as a client...* -```python +
httpx
+ +```{ .python .httpx } >>> r = httpx.get('https://www.example.org/') >>> r @@ -32,34 +38,59 @@ $ pip install git+https://github.com/encode/httpnext.git '\n\n\nExample Domain...' ``` +```{ .python .ahttpx .hidden } +>>> r = await ahttpx.get('https://www.example.org/') +>>> r + +>>> r.status_code +200 +>>> r.headers['content-type'] +'text/html; charset=UTF-8' +>>> r.text +'\n\n\nExample Domain...' +``` + *Serving responses as the server...* -```python + + +```{ .python .httpx } >>> def hello_world(request): ... content = httpx.HTML('hello, world.') ... return httpx.Response(code=200, content=content) -... + >>> with httpx.serve_http(hello_world) as server: ... print(f"Serving on {server.url} (Press CTRL+C to quit)") -... server.wait() +... server.serve() +Serving on http://127.0.0.1:8080/ (Press CTRL+C to quit) +``` + +```{ .python .ahttpx .hidden } +>>> async def hello_world(request): +... content = httpx.HTML('hello, world.') +... return httpx.Response(code=200, content=content) + +>>> async with httpx.serve_http(hello_world) as server: +... print(f"Serving on {server.url} (Press CTRL+C to quit)") +... await server.serve() Serving on http://127.0.0.1:8080/ (Press CTRL+C to quit) ``` --- -Features include... +Some things HTTPX supports... -* Available in either sync or async flavours. -* A comprehensive set of HTTP components, with immutability throughout. -* A low complexity stack, with no required dependencies. -* Type annotation throughout. +* Use it as an HTTP client, to interact with the web. +* Use it as an HTTP server, to create web APIs, applications, or websites. +* Use it as a general purpose toolkit, for working with URLs, query parameters & forms. +* Use it to build networking components, such as proxies. + +Components provided by HTTPX are immutable by default, and provide tightly typed interfaces. The package has a light installation footprint, minimal stdlib imports, and no dependencies. --- # Documentation -The httpx 1.0 [design proposal](https://www.encode.io/httpnext/) is now available. - * [Quickstart](docs/quickstart.md) * [Clients](docs/clients.md) * [Servers](docs/servers.md) @@ -78,19 +109,10 @@ The httpx 1.0 [design proposal](https://www.encode.io/httpnext/) is now availabl The design repository for this work is currently private. We are looking towards a development model that encourages a calm focused working environment, and are currently taking a little time to work through expectations & boundaries for contributions to the codebase. ---- - -# Background - -If you've been working with 0.x versions of HTTPX you'll notice significant API differences. - -Version 1.0 provides a much more tightly constrained API. It has a lighter installation footprint, far more obvious type annotations, and a lower overall complexity. - -For example: +Getting to 1.0 has required reworking from the ground up, and presents a significantly sharper API than previous versions. Pin your dependencies. We are currently in prerelease mode. -* Client code [before](https://github.com/encode/httpx/blob/master/httpx/_client.py) and [after](https://github.com/encode/httpnext/blob/dev/src/httpx/_client.py). -* Response code [before](https://github.com/encode/httpx/blob/master/httpx/_models.py#L515) and [after](https://github.com/encode/httpnext/blob/dev/src/httpx/_response.py). +This work is made possible through [project sponsorships](https://github.com/sponsors/encode). Your support is greatly appreciated. --- -

This provisional design work is not currently licensed for reuse.
— 🦋 —

+

This design work is not yet licensed for reuse.
— 🦋 —

diff --git a/docs/templates/base.html b/docs/templates/base.html index e6a6ca5..47a3938 100644 --- a/docs/templates/base.html +++ b/docs/templates/base.html @@ -1,5 +1,4 @@ - @@ -13,6 +12,30 @@ +