Skip to main content

Async DNSBL lists checker

Project description

aiodnsbl

PyPI version Python CI Coverage Status

DNSBL lists checker based on aiodns. Checks if an IP or a domain is listed on anti-spam DNS blacklists.

Notes

This is a fork of pydnsbl.

Key differences:

  • Fully type annotated
  • No sync wrapper (async only)
  • No category classification

Installation

pip install aiodnsbl

Usage

import asyncio

from aiodnsbl import DNSBLChecker


loop = asyncio.get_event_loop()

checker = DNSBLChecker()

# Check IP
loop.run_until_complete(checker.check("8.8.8.8"))
# <DNSBLResult: 8.8.8.8  (0/10)>
loop.run_until_complete(checker.check("68.128.212.240"))
# <DNSBLResult: 68.128.212.240 [BLACKLISTED] (4/10)>

# Check domain
loop.run_until_complete(checker.check("example.com"))
# <DNSBLResult: example.com  (0/4)>

# Bulk check
loop.run_until_complete(
    checker.bulk_check(["example.com", "8.8.8.8", "68.128.212.240"])
)
# [<DNSBLResult: example.com  (0/4)>, <DNSBLResult: 8.8.8.8  (0/10)>, <DNSBLResult: 68.128.212.240 [BLACKLISTED] (4/10)>]
import asyncio

from aiodnsbl import DNSBLChecker


async def main():
    checker = DNSBLChecker()
    res = await checker.check("68.128.212.240")
    print(res)
    # <DNSBLResult: 68.128.212.240 [BLACKLISTED] (4/10)>
    print(res.blacklisted)
    # True
    print([provider.host for provider in res.providers])
    # ['b.barracudacentral.org', 'bl.spamcop.net', 'dnsbl.sorbs.net', 'ips.backscatterer.org', ...]
    print([provider.host for provider in res.detected_by])
    # ['b.barracudacentral.org', 'dnsbl.sorbs.net', 'spam.dnsbl.sorbs.net', 'zen.spamhaus.org']


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Project details


Download files

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

Source Distribution

aiodnsbl-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

aiodnsbl-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file aiodnsbl-1.0.0.tar.gz.

File metadata

  • Download URL: aiodnsbl-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

File hashes

Hashes for aiodnsbl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 549422155d24358497ee3c4c4504d8836eb1d168853d907716fbb15eb70774a6
MD5 b4c2e5b87b6bcc7d5f4b452c2e2811a2
BLAKE2b-256 faa6e6f861a974dbc28894203a8eba9c7a5c9b0f4dc314d84bf1a280131a1ecc

See more details on using hashes here.

File details

Details for the file aiodnsbl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiodnsbl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

File hashes

Hashes for aiodnsbl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ff2fb00ba9516cfa375fd9c990197741f0dfcf41ad53d13d637adfdf6aa6ce5
MD5 1f90ce7da7d2f07981127566897c97fc
BLAKE2b-256 0649171bd119670e6a03fad2563ced90fcece162532dedccd0dc74f364816878

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