Python 2/3 library for doing async http requests with python futures. It's strives to be completely API-compatible with requests, just returning futures objects wrapping the response rather than the response itself.
What's the difference between this Python project and similar ones?
Super easy to use, no event loops or anything like that to manage. Uses the new concurrent.futures functionality in Python 3 and it's backport in Python 2.
fromrequests_futures.sessionsimportFuturesSessionsession=FuturesSession()# first request is started in backgroundfuture_one=session.get('http://httpbin.org/get')# second request is started immediatelyfuture_two=session.get('http://httpbin.org/get?foo=bar')# wait for the first request to complete, if it hasn't alreadyresponse_one=future_one.result()print('response one status: {0}'.format(response_one.status_code))print(response_one.content)# wait for the second request to complete, if it hasn't alreadyresponse_two=future_two.result()print('response two status: {0}'.format(response_two.status_code))print(response_two.content)
--
Anyone who agrees with this pull request could vote for it by adding a 👍 to it, and usually, the maintainer will merge it when votes reach 20.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/vinta/awesome-python/pull/939
**Author:** [@ross](https://github.com/ross)
**Created:** 9/22/2017
**Status:** ❌ Closed
**Base:** `master` ← **Head:** `patch-1`
---
### 📝 Commits (2)
- [`77d4e33`](https://github.com/vinta/awesome-python/commit/77d4e336e89a0db813f0bbe5de6a4ca0d209b13a) Add requests-futures to the HTTP section
- [`44d45dc`](https://github.com/vinta/awesome-python/commit/44d45dcde90eea2d0016dba6c7b20673230f648d) Merge branch 'master' into patch-1
### 📊 Changes
**1 file changed** (+1 additions, -0 deletions)
<details>
<summary>View changed files</summary>
📝 `README.md` (+1 -0)
</details>
### 📄 Description
## What is this Python project?
Python 2/3 library for doing async http requests with python futures. It's strives to be completely API-compatible with requests, just returning futures objects wrapping the response rather than the response itself.
## What's the difference between this Python project and similar ones?
Super easy to use, no event loops or anything like that to manage. Uses the new [`concurrent.futures`](https://docs.python.org/3/library/concurrent.futures.html) functionality in Python 3 and it's backport in Python 2.
```python
from requests_futures.sessions import FuturesSession
session = FuturesSession()
# first request is started in background
future_one = session.get('http://httpbin.org/get')
# second request is started immediately
future_two = session.get('http://httpbin.org/get?foo=bar')
# wait for the first request to complete, if it hasn't already
response_one = future_one.result()
print('response one status: {0}'.format(response_one.status_code))
print(response_one.content)
# wait for the second request to complete, if it hasn't already
response_two = future_two.result()
print('response two status: {0}'.format(response_two.status_code))
print(response_two.content)
```
--
Anyone who agrees with this pull request could vote for it by adding a :+1: to it, and usually, the maintainer will merge it when votes reach **20**.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/vinta/awesome-python/pull/939
Author: @ross
Created: 9/22/2017
Status: ❌ Closed
Base:
master← Head:patch-1📝 Commits (2)
77d4e33Add requests-futures to the HTTP section44d45dcMerge branch 'master' into patch-1📊 Changes
1 file changed (+1 additions, -0 deletions)
View changed files
📝
README.md(+1 -0)📄 Description
What is this Python project?
Python 2/3 library for doing async http requests with python futures. It's strives to be completely API-compatible with requests, just returning futures objects wrapping the response rather than the response itself.
What's the difference between this Python project and similar ones?
Super easy to use, no event loops or anything like that to manage. Uses the new
concurrent.futuresfunctionality in Python 3 and it's backport in Python 2.--
Anyone who agrees with this pull request could vote for it by adding a 👍 to it, and usually, the maintainer will merge it when votes reach 20.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.