On 2022-02-12 20:15:43 +0000, Shaozhong SHI wrote: > The following is used in a loop to get response code for each url. > > print (urllib.request.urlopen(url).getcode()) > > However, error message says: URLError: <urlopen error [Errno 11001] > getaddrinfo failed> > > Python 3.6.5 is being used to test whether url is live or not. > > Can anyone shed light on this?
getaddrinfo is the function that resolves a domain name into an IP address. If that fails, either the domain name doesn't exist or you have a problem with your DNS setup. Things to test: * Can you resolve the domain name to an address (try «nslookup» or «host» or «dig» depending on your OS)? * Can you access the whole URL with a different tool like «wget» or «curl»? hp -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | h...@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list