{"id":13813597,"url":"https://github.com/requests/requests-threads","last_synced_at":"2025-04-06T19:12:42.497Z","repository":{"id":38867853,"uuid":"102371328","full_name":"requests/requests-threads","owner":"requests","description":"🎭 Twisted Deferred Thread backend for Requests. ","archived":false,"fork":false,"pushed_at":"2019-04-26T15:53:58.000Z","size":19,"stargazers_count":417,"open_issues_count":9,"forks_count":27,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-30T17:11:25.765Z","etag":null,"topics":["async","asyncio","deferred","requests","threads","twisted"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/requests.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-04T14:40:02.000Z","updated_at":"2024-11-19T06:19:03.000Z","dependencies_parsed_at":"2022-09-01T14:01:45.370Z","dependency_job_id":null,"html_url":"https://github.com/requests/requests-threads","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Frequests-threads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Frequests-threads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Frequests-threads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/requests%2Frequests-threads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/requests","download_url":"https://codeload.github.com/requests/requests-threads/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247535519,"owners_count":20954576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","asyncio","deferred","requests","threads","twisted"],"created_at":"2024-08-04T04:01:22.558Z","updated_at":"2025-04-06T19:12:42.465Z","avatar_url":"https://github.com/requests.png","language":"Python","readme":"requests-threads 🎭\n===================\n\nThis repo contains a Requests session that returns the amazing `Twisted \u003chttp://twistedmatrix.com/trac/\u003e`_'s awaitable\nDeferreds instead of Response objects.\n\nIt's awesome, basically — check it out:\n\n.. image:: https://farm5.staticflickr.com/4418/35904417594_c4933a2171_k_d.jpg\n\n\nExamples\n--------\n\nLet's send 100 concurrent requests! \\\\o/\n\n**Example Usage** using ``async``/``await`` —\n\n.. code:: python\n\n\tfrom requests_threads import AsyncSession\n\n\tsession = AsyncSession(n=100)\n\n\tasync def _main():\n\t    rs = []\n\t    for _ in range(100):\n\t        rs.append(await session.get('http://httpbin.org/get'))\n\t    print(rs)\n\n\tif __name__ == '__main__':\n\t    session.run(_main)\n\n*This example works on Python 3 only.* You can also provide your own ``asyncio`` event loop!\n\n**Example Usage** using Twisted —\n\n.. code:: python\n\n\t\n\tfrom twisted.internet.defer import inlineCallbacks\n\tfrom twisted.internet.task import react\n\tfrom requests_threads import AsyncSession\n\t\n\tsession = AsyncSession(n=100)\n\n\t@inlineCallbacks\n\tdef main(reactor):\n\t    responses = []\n\t    for i in range(100):\n\t        responses.append(session.get('http://httpbin.org/get'))\n\n\t    for response in responses:\n\t        r = yield response\n\t        print(r)\n\n\tif __name__ == '__main__':\n\t    react(main)\n\n*This example works on both Python 2 and Python 3.*\n\n--------------------\n\nEach request is sent via a new thread, automatically. This works fine for basic\nuse cases. This automatically uses Twisted's ``asyncioreactor``, if you do not\nprovide your own reactor (progress to be made there, help requested!).\n\n**This is a an experiment**, and a preview of the true asynchronous API we have planned for Requests\nthat 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 \u003cmailto:me@kennethreitz.org\u003e`_).\n\nThis API is likely to change, over time, slightly.\n\nInstallation\n------------\n\n::\n\n    $ pipenv install requests-threads\n    ✨🍰✨\n\n\nInspiration\n-----------\n\nThis codebase was inspired by future work on Requests, as well as `requests-twisted \u003chttps://pypi.python.org/pypi/requests-twisted/\u003e`_.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequests%2Frequests-threads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frequests%2Frequests-threads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frequests%2Frequests-threads/lists"}