dns

How do I get my computer's fully qualified domain name in Python?

How do I get my computer's fully qualified domain name in Python? Question: I know I can use platform.node() to get my computer’s network name: >>> import platform >>> platform.node() ‘MyComputerName’ But what I really want is something that will work similar to the following: >>> get_full_network_domain_name() ‘MyComputerName.it.na.mycompany.com’ Does something like this exist? Asked By: …

Total answers: 1

how to get expired domain names by python

how to get expired domain names by python Question: I am writing a function by python to get a list of expired domains just like this one, but I can not find any library can do this, any ideas about this? Asked By: huangli || Source Answers: Why should there be a library for this …

Total answers: 2

Find email domain in address with regular expressions

Find email domain in address with regular expressions Question: I know I’m an idiot, but I can’t pull the domain out of this email address: ‘[email protected]’ My desired output: ‘@gmail.com’ My current output: . (it’s just a period character) Here’s my code: import re test_string = ‘[email protected]’ domain = re.search(‘@*?.’, test_string) print domain.group() Here’s what …

Total answers: 7

Set specific DNS server using dns.resolver (pythondns)

Set specific DNS server using dns.resolver (pythondns) Question: I am using dns.resolver from dnspython. Is it possible to set the IP address of the server to use for queries ? Asked By: Massimo || Source Answers: You don’t specify in your question, but assuming you’re using the resolver from dnspython.org, the documentation indicates you want …

Total answers: 4

How can I do DNS lookups in Python, including referring to /etc/hosts?

How can I do DNS lookups in Python, including referring to /etc/hosts? Question: dnspython will do my DNS lookups very nicely, but it entirely ignores the contents of /etc/hosts. Is there a python library call which will do the right thing? ie check first in etc/hosts, and only fall back to DNS lookups otherwise? Asked …

Total answers: 6

Python lookup hostname from IP with 1 second timeout

Python lookup hostname from IP with 1 second timeout Question: How can I look up a hostname given an IP address? Furthermore, how can I specify a timeout in case no such reverse DNS entry exists? Trying to keep things as fast as possible. Or is there a better way? Thank you! Asked By: ensnare …

Total answers: 2

How can I get DNS records for a domain in python?

How can I get DNS records for a domain in python? Question: How do I get the DNS records for a zone in python? I’m looking for data similar to the output of dig. Asked By: Dave Forgac || Source Answers: Try the dnspython library: http://www.dnspython.org/ You can see some examples here: https://www.dnspython.org/examples/ Answered By: …

Total answers: 5

How to extract top-level domain name (TLD) from URL

How to extract top-level domain name (TLD) from URL Question: how would you extract the domain name from a URL, excluding any subdomains? My initial simplistic attempt was: ‘.’.join(urlparse.urlparse(url).netloc.split(‘.’)[-2:]) This works for http://www.foo.com, but not http://www.foo.com.au. Is there a way to do this properly without using special knowledge about valid TLDs (Top Level Domains) or …

Total answers: 8