https://github.com/vizonex/aiohttp-tor
A aiohttp extension for using aiohttp with tor for hosting onionsites & client requests
https://github.com/vizonex/aiohttp-tor
aiohttp aiostem asyncio python-asyncio python3 stem tor
Last synced: about 1 month ago
JSON representation
A aiohttp extension for using aiohttp with tor for hosting onionsites & client requests
- Host: GitHub
- URL: https://github.com/vizonex/aiohttp-tor
- Owner: Vizonex
- License: mit
- Created: 2025-09-04T14:49:01.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-09-04T14:55:07.000Z (about 1 month ago)
- Last Synced: 2025-09-04T16:34:31.453Z (about 1 month ago)
- Topics: aiohttp, aiostem, asyncio, python-asyncio, python3, stem, tor
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Aiohttp-Tor
Inspired by the stem library from the tor-project, this project attempts to make
seemless transitions with aiohttp and tor. For both clients and hosting.## Running Clients
```python
from aiohttp_tor import launch, MessageHandler
from aiohttp import ClientSession
import asyncio# if you want to use the init_msg_handler here's the steps to follow.
handler = MessageHandler()@handler.on_message
async def send_message(msg:str):
print(msg)async def request_for_onionsite():
async with launch(ctrl_port=9051, socks_port=9050, init_msg_handler=handler) as process:
# NOTE: use connect() to avoid any annoying setups.
# there's nothing more stressful than remebering what ports to use.
async with ClientSession(connector=process.connect()) as session:
async with session.get("http://mf34jlghauz5pxjcmdymdqbe5pva4v24logeys446tdrgd5lpsrocmqd.onion/index.html") as resp:
data = await resp.read()
print(data)
# b'\n\nHi Grandma!