Hello,<br><br>I am writing some scraper scripts and need to pass them through an intercepting proxy. getPage does not support a proxy argument and this code I found on internet won&#39;t work with SSL proxy (stalls indefinitely):<br>
<br><span style="font-family: courier new,monospace;">def getPage(url, contextFactory=None, *args, **kwargs):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    scheme, host, port, path = _parse(url)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    factory = HTTPClientFactory(url, *args, **kwargs)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    if 0: # use a proxy</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        host, port = &#39;localhost&#39;, 8080</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        factory.path = url</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    if scheme == &#39;https&#39;:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        from twisted.internet import ssl</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        if contextFactory is None:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            contextFactory = ssl.ClientContextFactory()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        reactor.connectSSL(host, port, factory, contextFactory)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    else:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        reactor.connectTCP(host, port, factory)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    return factory.deferred</span><br>
<br>Plain http proxying works. My guess is that there is an issue with self-signed or otherwise invalid certificate the http proxy supplies. Any clues?<br><br>--<br>Konrads Smelkovs<br>Applied IT sorcery.<br>