A DHT crawler framework using asyncio.
Usage
from maga import Maga
import logging
logging.basicConfig(level=logging.INFO)
class Crawler(Maga):
async def handler(self, infohash, addr):
logging.info(addr)
logging.info(infohash)
# Or, if you want to have more control
class Crawler(Maga):
async def handle_get_peers(self, infohash, addr):
logging.info(
"Receive get peers message from DHT {}. Infohash: {}.".format(
addr, infohash
)
)
async def handle_announce_peer(self, infohash, addr, peer_addr):
logging.info(
"Receive announce peer message from DHT {}. Infohash: {}. Peer address:{}".format(
addr, infohash, peer_addr
)
)
crawler = Crawler()
# Set port to 0 will use a random available port
crawler.run(port=0)
ChangeLog
Version 3.0.0
Add peer_addr param to handle_announce_peer method.
Don’t raise NotImplementedError on handler
Version 2.0.1
Don’t fail when signals are not implemented.( #3 )
Version 2.0.0
Add handle_get_peers, handle_announce_peer method.
Add addr param to handler
Release files for Maga 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | |
|---|---|---|---|
| Maga-3.0.0.zip | 7.2 kB | Details | |
| Maga-3.0.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Maga-3.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 16.5 kB
Release files / Maga-3.0.0.zip
| Download URL | Maga-3.0.0.zip |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c913766318c34f5c51f3456f23861445d9c2c1890fe98c471d20fa0d48e38aaf
|
|
BLAKE2b-256 checksum How to use checksums |
82fe4a873349eaf76d4e60ae23902bbc0367a3a2de417a34dd56a50c34186e17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / Maga-3.0.0.tar.gz
| Download URL | Maga-3.0.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9278c3c57ae653b5d6fe01790ef7f93d98ca258eba128a4d974d8e81fc36a91
|
|
BLAKE2b-256 checksum How to use checksums |
0e85875d75198325ce30b2fce20332fed281ed1dcc64d0d45d96ad99fab31fec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / Maga-3.0.0-py2.py3-none-any.whl
| Download URL | Maga-3.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b955137d818325399c81c1a45fd380fcc6510a715be7eab533f6a0bafd20ad0f
|
|
BLAKE2b-256 checksum How to use checksums |
7bac0de163f6cb7a6e3082fae3ffbed46116537c19d85eac423a0dc834ba966a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |