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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not really sure if you want to do DNS lookups yourself or if you just want a host’s ip. In case you want the latter,
from
man gethostbyname: