{"id":30811586,"url":"https://github.com/vizonex/aiohttp-tor","last_synced_at":"2025-09-06T06:12:39.331Z","repository":{"id":313215270,"uuid":"1050522828","full_name":"Vizonex/aiohttp-tor","owner":"Vizonex","description":"A aiohttp extension for using aiohttp with tor for hosting onionsites \u0026 client requests","archived":false,"fork":false,"pushed_at":"2025-09-04T14:55:07.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-04T16:34:31.453Z","etag":null,"topics":["aiohttp","aiostem","asyncio","python-asyncio","python3","stem","tor"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vizonex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-04T14:49:01.000Z","updated_at":"2025-09-04T14:55:11.000Z","dependencies_parsed_at":"2025-09-04T16:34:34.166Z","dependency_job_id":"bfb493ed-34cd-42a6-86c1-ef5bde398c5a","html_url":"https://github.com/Vizonex/aiohttp-tor","commit_stats":null,"previous_names":["vizonex/aiohttp-tor"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Vizonex/aiohttp-tor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vizonex%2Faiohttp-tor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vizonex%2Faiohttp-tor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vizonex%2Faiohttp-tor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vizonex%2Faiohttp-tor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vizonex","download_url":"https://codeload.github.com/Vizonex/aiohttp-tor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vizonex%2Faiohttp-tor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273863687,"owners_count":25181646,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["aiohttp","aiostem","asyncio","python-asyncio","python3","stem","tor"],"created_at":"2025-09-06T06:12:34.716Z","updated_at":"2025-09-06T06:12:39.322Z","avatar_url":"https://github.com/Vizonex.png","language":"Python","readme":"# Aiohttp-Tor\r\n\r\nInspired by the stem library from the tor-project, this project attempts to make \r\nseemless transitions with aiohttp and tor. For both clients and hosting. \r\n\r\n## Running Clients\r\n```python\r\nfrom aiohttp_tor import launch, MessageHandler\r\nfrom aiohttp import ClientSession\r\nimport asyncio\r\n\r\n\r\n# if you want to use the init_msg_handler here's the steps to follow.\r\nhandler = MessageHandler()\r\n\r\n@handler.on_message\r\nasync def send_message(msg:str):\r\n    print(msg)\r\n\r\n\r\nasync def request_for_onionsite():\r\n    async with launch(ctrl_port=9051, socks_port=9050, init_msg_handler=handler) as process:\r\n        # NOTE: use connect() to avoid any annoying setups. \r\n        # there's nothing more stressful than remebering what ports to use.\r\n        async with ClientSession(connector=process.connect()) as session:\r\n            async with session.get(\"http://mf34jlghauz5pxjcmdymdqbe5pva4v24logeys446tdrgd5lpsrocmqd.onion/index.html\") as resp:\r\n                data = await resp.read()\r\n                print(data)\r\n                # b'\\n\\n\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\\n ... and so on...\r\n\r\n    \r\n\r\nif __name__ == \"__main__\":\r\n    asyncio.run(request_for_onionsite())\r\n```\r\n\r\n\r\n## Running Tor Hidden Services\r\n\r\n```python\r\nfrom aiohttp_tor.web import run_app\r\nfrom aiohttp.web import Application, RouteTableDef, Request, Response\r\n\r\nimport winloop # There's custom options for uvloop/winloop thanks to loop_factory\r\n\r\nroutes = RouteTableDef()\r\napp = Application()\r\n\r\n@routes.get('/')\r\nasync def index(request:Request):\r\n    return Response(body=b\"\u003chtml\u003e\u003cbody\u003e\u003ch1\u003eHi Grandma!\u003c/h1\u003e\u003c/body\u003e\u003c/html\u003e\", content_type=\"text/html\")\r\n\r\n# Tor hidden service will be located in a .tor-hs directory\r\n# unless you pass a hidden_service_dir parameter, this is to make \r\n# things friendly for beginners but it's encouraged to change it's path \r\n# so that bad actors can't find it.\r\n\r\nif __name__ == \"__main__\":\r\n    app.add_routes(routes)\r\n    run_app(app, loop_factory=winloop.new_event_loop, port=6999)\r\n\r\n```\r\n\r\n## Requirements\r\n- Python 3.10+ (Due to how aiostem works)\r\n- aiostem\r\n- aiohttp-socks (For sending Client Requests)\r\n- aiohttp\r\n\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvizonex%2Faiohttp-tor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvizonex%2Faiohttp-tor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvizonex%2Faiohttp-tor/lists"}