I need to get original TTL for dns record on each query. DNS resolver shows original ttl only at first query. It shows time to reset cache on each next query.
>>> answer = dns.resolver.query('www.stackoverflow.com')
>>> print answer.rrset.ttl
300
>>> answer = dns.resolver.query('www.stackoverflow.com')
>>> print answer.rrset.ttl
292
How can I get original TTL at any query?
You can only get the original TTL by directly querying the authoritative server. This is not Python-specific.
NS
records for the desired name. If you find no NS records for the name then remove the first label and query again (query the parent domain). Recursively repeat until you get some NS records.This is basically equivalent to doing part of the job of a recursive resolver.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With