Hello! Such a problem, wrote the code to try to send a request to the server, and find out if there is a redirect. It works with all URLs, but yesterday I discovered a strange thing, I can’t connect to this URL: ' http://nl.wikipedia.org/wiki/ISO_3166-1 '
Here is the code:
import httplib2 url = 'nl.wikipedia.org/wiki/ISO_3166-1' connection = httplib2.HTTPConnectionWithTimeout(url) connection.request('HEAD', '/') response = connection.getresponse() if response.status in range(301, 304): if response.getheader('Location').startswith('https://' + url): self._options['href'].replace('http://', 'https://') ps What did I miss? Maybe it's better to use some other library? I would be grateful for any answers.