libweb.dns

DnsService

class libweb.dns.DnsService(creds=None, opts=None, **conf)[source]

A simple service based on DNS requests

Keyword Arguments:
 
  • rrname (str) – The record name to lookup
  • rrtype (str) – The DNS record type to request
  • split (str, optional) – A string with which to split the result (for TXT records)
get_resolver()[source]

Returns a dns.resolver.Resolver instance

get_results()[source]

Make the DNS requests and yield a structured response

get_rrname(rrname)[source]

Formats the rrname using the options passed to the service

Parameters:rrname (str) – A string template for rendering the rrname to be requested
make_requests()[source]

Iterate over the requests for this service and yield the rrsets

DnsblService

class libweb.dns.DnsblService(creds=None, opts=None, **conf)[source]

A DNS-based service where the service options are reversed for use in a DNSBL

Keyword Arguments:
 
  • rrname (str) – The record name to lookup
  • rrtype (str) – The DNS record type to request
  • split (str, optional) – A string with which to split the result (for TXT records)
get_rrname(rrname)[source]

Formats the rrname using the options passed to the service. All options are split using ”.” as the separator and then the order reversed, as is required for DNSBL services (such as Spamhaus).

Parameters:rrname (str) – A string template for rendering the rrname to be requested