Skip to main content

A DHT crawler framework using asyncio.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

Maga-3.0.0.zip (7.2 kB view details)

Uploaded Source

Maga-3.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

Maga-3.0.0-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Maga-3.0.0.zip.

File metadata

  • Download URL: Maga-3.0.0.zip
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Maga-3.0.0.zip
Algorithm Hash digest
SHA256 c913766318c34f5c51f3456f23861445d9c2c1890fe98c471d20fa0d48e38aaf
MD5 9cd16f175a4cc76e804ec632be93d6ee
BLAKE2b-256 82fe4a873349eaf76d4e60ae23902bbc0367a3a2de417a34dd56a50c34186e17

See more details on using hashes here.

File details

Details for the file Maga-3.0.0.tar.gz.

File metadata

  • Download URL: Maga-3.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Maga-3.0.0.tar.gz
Algorithm Hash digest
SHA256 d9278c3c57ae653b5d6fe01790ef7f93d98ca258eba128a4d974d8e81fc36a91
MD5 0c10fc4250e9f69e19e385ca6e04e1fc
BLAKE2b-256 0e85875d75198325ce30b2fce20332fed281ed1dcc64d0d45d96ad99fab31fec

See more details on using hashes here.

File details

Details for the file Maga-3.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Maga-3.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b955137d818325399c81c1a45fd380fcc6510a715be7eab533f6a0bafd20ad0f
MD5 f501f20054475f752e6f6047bb4c7fdf
BLAKE2b-256 7bac0de163f6cb7a6e3082fae3ffbed46116537c19d85eac423a0dc834ba966a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page