Skip to main content

async-await support for `requests`.

Project description

requests-async

Brings support for async/await syntax to Python's fabulous requests library.

Build Status Coverage Package version

Contributions towards closing off our outstanding issues would be very welcome! ✨ 🍰 ✨

Requirements

  • Python 3.6, 3.7.

Installation

$ pip install requests-async

Usage:

Just use the standard requests API, but use await for making requests.

Note: Use ipython to try this from the console, since it supports await.

import requests_async as requests


response = await requests.get('https://example.org')
print(response.status_code)
print(response.text)

Or use explicit sessions.

import requests_async as requests


with requests.Session() as session:
    response = await requests.get('https://example.org')
    print(response.status_code)
    print(response.text)

The requests_async package subclasses requests, so you're getting all the standard behavior and API you'd expect.

Limitations

  • Streaming uploads and downloads are unsupported.
  • SSL verification is not currently enabled.
  • No timeout support yet.

See the issues list for more details.

Alternatives

The aiohttp package provides an alternative client for making async HTTP requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests-async-0.1.0.tar.gz (7.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page