[Twisted-Python] connecting through an http proxy

Salil hellfeuer at gmail.com
Thu Sep 3 05:07:31 EDT 2009


Thanks for your reply. The app I was interested in fixing was gm-notify (
https://code.launchpad.net/gm-notify) which is a notifier for gmail. But to
be honest I've since lost interest in the question because I patched gwibber
to read the gmail atom feed instead of fixing this :)

Anyway the relevant code is:
d = defer.Deferred()
c = ClientCreator(reactor, IMAPClient)
c.connectSSL("imap.gmail.com", 993,
ssl.ClientContextFactory()).addCallback(self._gotProtocol, d)

Here connectSSL should use a proxy
In case someone knows how to fix this I'm sure there will be other people
who will appreciate it (https://bugs.launchpad.net/gm-notify/+bug/371878)

Thanks

On Wed, Sep 2, 2009 at 3:21 AM, <exarkun at twistedmatrix.com> wrote:

> On 05:28 pm, hellfeuer at gmail.com wrote:
> >First of let me say that I'm *very* new to twisted (I'm only trying to
> >patch
> >an app that uses twisted). So sorry if this is a stupid question.
> >
> >The problem is I am behind an http proxy (with authentication), so I
> >need to
> >connect through that proxy. The documentation doesn't help (me) much
> >and
> >neither does google (mostly because there are a million people who have
> >created their own proxy server. This is not what I want to do).
> >
> >Any tips? The app is currently using ClientCreator (to make an SSL
> >connection), but I'm willing to change all that if necessary.
>
> If you're using twisted.web.client, then this will be tough, as there
> really isn't any support for HTTP proxies in that API.  You might be
> able to get something to work if you're using HTTPPageGetter directly,
> though - specify the right proxy authentication headers in the headers
> dictionary you give to the factory, make sure you put the full URI in
> the request path, etc.
>
> If you're doing something else, then maybe you can elaborate on that. :)
>
> The new HTTP client API which has not yet been part of any release will
> make this easier, but that doesn't help you if you need to work with an
> existing version of Twisted.
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090903/77e716f7/attachment.htm 


More information about the Twisted-Python mailing list