]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Add an async example to intro snippets (#750)
authorFlorimond Manca <florimond.manca@gmail.com>
Tue, 14 Jan 2020 09:01:09 +0000 (10:01 +0100)
committerTom Christie <tom@tomchristie.com>
Tue, 14 Jan 2020 09:01:09 +0000 (09:01 +0000)
README.md
docs/index.md

index cf6b9b3a89ac8a90097a62ac205b5da58b678a44..27fd542ed454d52e95f64404d808d3cf65739633 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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:
index e3d6e2a502fccc6c69906e35c7084a590a5e4a18..476f62af428db48ddee43b1204053593a6dd3f1e 100644 (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