diff --git a/docs/networking.md b/docs/networking.md index f7665c9..ec918aa 100644 --- a/docs/networking.md +++ b/docs/networking.md @@ -120,6 +120,26 @@ with httpx.timeout(3.0) as t: --- +## Rate limiting + +Network rate limiting can be applied using context blocks. + +```python +with httpx.rate_limit("25MB/s"): + ... +``` + +Differing rate limits for upload and download speeds may be applied. + +```python +with httpx.rate_limit(upload="10MB/s", download="25MB/s"): + ... +``` + +Supported data rates must be specified in units of bytes per second... `B/s`, `KB/s`, `MB/s`, `GB/s`, `TB/s`. + +--- + ## Sending HTTP requests Let's take a look at how we can work directly with a network backend to send an HTTP request, and recieve an HTTP response.