Add an async example to intro snippets (#750)

This commit is contained in:
Florimond Manca 2020-01-14 10:01:09 +01:00 committed by Tom Christie
parent 780d1843ca
commit 7d84408cda
2 changed files with 24 additions and 0 deletions

View File

@ -39,6 +39,18 @@ Let's get started...
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'
```
Or, using the async API...
_Use [IPython](https://ipython.readthedocs.io/en/stable/) or Python 3.8+ with `python -m asyncio` to try this code interactively._
```python
>>> import httpx
>>> async with httpx.AsyncClient() as client:
>>> r = await client.get('https://www.example.org/')
>>> r
<Response [200 OK]>
```
## Features
HTTPX builds on the well-established usability of `requests`, and gives you:

View File

@ -51,6 +51,18 @@ Let's get started...
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'
```
Or, using the async API...
_Use [IPython](https://ipython.readthedocs.io/en/stable/) or Python 3.8+ with `python -m asyncio` to try this code interactively._
```python
>>> import httpx
>>> async with httpx.AsyncClient() as client:
>>> r = await client.get('https://www.example.org/')
>>> r
<Response [200 OK]>
```
## Features
HTTPX is a high performance asynchronous HTTP client, that builds on the