All Projects → requests → Requests Threads

requests / Requests Threads

🎭 Twisted Deferred Thread backend for Requests.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Requests Threads

Arsenic
Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Stars: ✭ 209 (-42.9%)
Mutual labels:  async, asyncio, twisted
Pyee
A port of Node.js's EventEmitter to python
Stars: ✭ 236 (-35.52%)
Mutual labels:  async, asyncio, twisted
prometheus-async
Async helpers for prometheus_client.
Stars: ✭ 136 (-62.84%)
Mutual labels:  twisted, asyncio
python3-concurrency
Python3爬虫系列的理论验证,首先研究I/O模型,分别用Python实现了blocking I/O、nonblocking I/O、I/O multiplexing各模型下的TCP服务端和客户端。然后,研究同步I/O操作(依序下载、多进程并发、多线程并发)和异步I/O(asyncio)之间的效率差别
Stars: ✭ 49 (-86.61%)
Mutual labels:  requests, asyncio
Picoweb
Really minimal web application framework for the Pycopy project (minimalist Python dialect) and its "uasyncio" async framework
Stars: ✭ 361 (-1.37%)
Mutual labels:  async, asyncio
Example Hftish
Example Order Book Imbalance Algorithm
Stars: ✭ 355 (-3.01%)
Mutual labels:  async, asyncio
Uvicorn Gunicorn Docker
Docker image with Uvicorn managed by Gunicorn for high-performance web applications in Python 3.6 with performance auto-tuning. Optionally with Alpine Linux.
Stars: ✭ 244 (-33.33%)
Mutual labels:  async, asyncio
Aiowebsocket
Async WebSocket Client. Advantage: Flexible Lighter and Faster
Stars: ✭ 263 (-28.14%)
Mutual labels:  async, asyncio
Gidgethub
An async GitHub API library for Python
Stars: ✭ 226 (-38.25%)
Mutual labels:  async, twisted
Aiologger
Asynchronous logging for python and asyncio
Stars: ✭ 284 (-22.4%)
Mutual labels:  async, asyncio
Python3 Concurrency Pics 02
爬取 www.mzitu.com 全站图片,截至目前共5162个图集,16.5万多张美女图片,使用 asyncio 和 aiohttp 实现的异步版本只需要不到2小时就能爬取完成。按日期创建图集目录,保存更合理。控制台只显示下载的进度条,详细信息保存在日志文件中。支持异常处理,不会终止爬虫程序。失败的请求,下次再执行爬虫程序时会自动下载
Stars: ✭ 275 (-24.86%)
Mutual labels:  asyncio, requests
Sqlalchemy aio
Asyncio strategy for SQLAlchemy.
Stars: ✭ 299 (-18.31%)
Mutual labels:  async, asyncio
Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (-34.43%)
Mutual labels:  async, asyncio
Curequests
Curio + Requests: Async HTTP for Humans
Stars: ✭ 243 (-33.61%)
Mutual labels:  async, requests
aioScrapy
基于asyncio与aiohttp的异步协程爬虫框架 欢迎Star
Stars: ✭ 34 (-90.71%)
Mutual labels:  twisted, asyncio
rigor
HTTP-based DSL for for validating RESTful APIs
Stars: ✭ 65 (-82.24%)
Mutual labels:  requests, asyncio
Umongo
sync/async MongoDB ODM, yes.
Stars: ✭ 331 (-9.56%)
Mutual labels:  asyncio, twisted
Aioreactive
Async/await reactive tools for Python 3.9+
Stars: ✭ 215 (-41.26%)
Mutual labels:  async, asyncio
Txtorcon
Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
Stars: ✭ 215 (-41.26%)
Mutual labels:  async, twisted
Example Scalping
A working example algorithm for scalping strategy trading multiple stocks concurrently using python asyncio
Stars: ✭ 267 (-27.05%)
Mutual labels:  async, asyncio

requests-threads 🎭

This repo contains a Requests session that returns the amazing Twisted <http://twistedmatrix.com/trac/>_'s awaitable Deferreds instead of Response objects.

It's awesome, basically — check it out:

.. image:: https://farm5.staticflickr.com/4418/35904417594_c4933a2171_k_d.jpg

Examples

Let's send 100 concurrent requests! \o/

Example Usage using async/await

.. code:: python

from requests_threads import AsyncSession

session = AsyncSession(n=100)

async def _main():
    rs = []
    for _ in range(100):
        rs.append(await session.get('http://httpbin.org/get'))
    print(rs)

if __name__ == '__main__':
    session.run(_main)

This example works on Python 3 only. You can also provide your own asyncio event loop!

Example Usage using Twisted —

.. code:: python

from twisted.internet.defer import inlineCallbacks
from twisted.internet.task import react
from requests_threads import AsyncSession

session = AsyncSession(n=100)

@inlineCallbacks
def main(reactor):
    responses = []
    for i in range(100):
        responses.append(session.get('http://httpbin.org/get'))

    for response in responses:
        r = yield response
        print(r)

if __name__ == '__main__':
    react(main)

This example works on both Python 2 and Python 3.


Each request is sent via a new thread, automatically. This works fine for basic use cases. This automatically uses Twisted's asyncioreactor, if you do not provide your own reactor (progress to be made there, help requested!).

This is a an experiment, and a preview of the true asynchronous API we have planned for Requests that is currently in the works, but requires a lot of development time. If you'd like to help (p.s. we need help, send me an email <mailto:[email protected]>_).

This API is likely to change, over time, slightly.

Installation

::

$ pipenv install requests-threads
✨🍰✨

Inspiration

This codebase was inspired by future work on Requests, as well as requests-twisted <https://pypi.python.org/pypi/requests-twisted/>_.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].