Ok, nevermind. Appereantly there is such a thing as HTTPSConnection. I thought httplib auto-handled https connections..
22 Eylül 2011 13:43 tarihinde Yaşar Arabacı <yasar11...@gmail.com> yazdı: > Hi, > > I wrote a function to get thorugh redirections and find a final page for a > given web-page. But following function gives maximum recursion error for any > https pages I tried. Do you know what might be the problem here? > > def getHeadResponse(url,response_cache = {}): > try: > return response_cache[url] > except KeyError: > url = urlparse.urlparse(url) > conn = httplib.HTTPConnection(url.netloc) > try: > conn.request("HEAD",url.path) > except: > # Anything can happen, this is SPARTA! > return None > response = conn.getresponse() > response_cache[url.geturl()] = response > return response > > def getFinalUrl(url): > "Navigates through redirections to get final url." > > response = getHeadResponse(url) > try: > if str(response.status).startswith("3"): > return getFinalUrl(response.getheader("location")) > except AttributeError: > pass > return url > -- > http://yasar.serveblog.net/ > > -- http://yasar.serveblog.net/
-- http://mail.python.org/mailman/listinfo/python-list