<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Hello</span><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">The code suggests it does - but I can&#39;t get it to work.</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><div>class ProxyAgent(_AgentBase):</div><div>    &quot;&quot;&quot;</div><div>    An HTTP agent able to cross HTTP proxies.</div>
<div><br></div><div>    @ivar _proxyEndpoint: The endpoint used to connect to the proxy.</div><div><br></div><div>    @since: 11.1</div><div>    &quot;&quot;&quot;</div><div><br></div><div>    def __init__(self, endpoint, reactor=None, pool=None):</div>

<div>        if reactor is None:</div><div>            from twisted.internet import reactor</div><div>        _AgentBase.__init__(self, reactor, pool)</div><div>        self._proxyEndpoint = endpoint</div><div><br></div>
<div>
<br></div><div>    def request(self, method, uri, headers=None, bodyProducer=None):</div><div>        &quot;&quot;&quot;</div><div>        Issue a new request via the configured proxy.</div><div>        &quot;&quot;&quot;</div>

<div>        # Cache *all* connections under the same key, since we are only</div><div>        # connecting to a single destination, the proxy:</div><div>        key = (&quot;http-proxy&quot;, self._proxyEndpoint)</div><div>

<br></div><div>        # To support proxying HTTPS via CONNECT, we will use key</div><div>        # (&quot;http-proxy-CONNECT&quot;, scheme, host, port), and an endpoint that</div><div>        # wraps _proxyEndpoint with an additional callback to do the CONNECT.</div>

<div>        return self._requestWithEndpoint(key, self._proxyEndpoint, method,</div><div>                                         _parse(uri), headers, bodyProducer,</div><div>                                         uri)</div>

</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">The &quot;Using a http proxy&quot; - <a href="http://twistedmatrix.com/documents/current/web/howto/client.html" style="color:rgb(17,85,204)" target="_blank">http://twistedmatrix.com/documents/current/web/howto/client.html</a>  works, provided the target url is http ( not https as shown in the example ).</div>

<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">I&#39;m attempting to adapt this example to confirm https proxing is possible</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><div>from twisted.python.log import err</div><div>from twisted.web.client import ProxyAgent</div><div>
from twisted.internet import reactor</div><div>from twisted.internet.endpoints import TCP4ClientEndpoint</div><div><br></div><div>def display(response):</div><div>    print &quot;Received response&quot;</div><div>    print response</div>

<div><br></div><div>def main():</div><div>    endpoint = TCP4ClientEndpoint(reactor, &quot;localhost&quot;, 8000)</div><div>    agent = ProxyAgent(endpoint)</div><div>    d = agent.request(&quot;GET&quot;, &quot;<a href="https://example.com/" style="color:rgb(17,85,204)" target="_blank">https://example.com/</a>&quot;)</div>

<div>    d.addCallbacks(display, err)</div><div>    d.addCallback(lambda ignored: reactor.stop())</div><div>    reactor.run()</div><div><br></div><div>if __name__ == &quot;__main__&quot;:</div><div>    main()</div></div>
<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">I&#39;ve tried changing the endpoint to SSL4ClientEndpoint without success.</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Any help, much appreciated</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">
- G</div>