This module implements DNS resolution with pycares.

exception slimta.util.dns.DNSError(errno)

Bases: Exception

Exception raised with DNS resolution failed. The exception message will contain more information.


The error number, as per pycares.errno.

class slimta.util.dns.DNSResolver([*args[, **kwargs]])

Bases: object

Manages all the active DNS queries using a single, static pycares.Channel object.


Before making any queries, this attribute may be set to override the default with a pycares.Channel object that will manage all DNS queries.

classmethod query(cls, name, query_type)

Begin a DNS lookup. The result (or exception) will be in the returned AsyncResult when it is available.

  • name (str) – The DNS name to resolve.

  • query_type – The DNS query type, see pycares.Channel.query() for options. A string may be given instead, e.g. 'MX'.

Return type