Ok, nevermind. Appereantly there is such a thing as HTTPSConnection. I thought httplib auto-handled https connections..<br><br><div class="gmail_quote">22 Eylül 2011 13:43 tarihinde Yaşar Arabacı <span dir="ltr"><<a href="mailto:yasar11732@gmail.com">yasar11732@gmail.com</a>></span> yazdı:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<div><br></div><div>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?</div>

<div><br></div><div><div>def getHeadResponse(url,response_cache = {}):</div><div>    try:</div><div>        return response_cache[url]</div><div>    except KeyError:</div><div>        url = urlparse.urlparse(url)</div><div>

        conn = httplib.HTTPConnection(url.netloc)</div><div>        try:</div><div>            conn.request("HEAD",url.path)</div><div>        except:</div><div>            # Anything can happen, this is SPARTA!</div>

<div>            return None</div><div>        response = conn.getresponse()</div><div>        response_cache[url.geturl()] = response</div><div>        return response</div><div><br></div><div><div>def getFinalUrl(url):</div>

<div>    "Navigates through redirections to get final url."</div><div><br></div><div>    response = getHeadResponse(url)</div><div>    try:</div><div>        if str(response.status).startswith("3"):</div>

<div>            return getFinalUrl(response.getheader("location"))</div><div>    except AttributeError:</div><div>        pass</div><div>    return url</div></div>-- <br><font color="#888888"><a href="http://yasar.serveblog.net/" target="_blank">http://yasar.serveblog.net/</a><br>

<br>
</font></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><a href="http://yasar.serveblog.net/" target="_blank">http://yasar.serveblog.net/</a><br><br>