[Twisted-Python] imap google mail client

Hello, first time here for me. I'm writing a little application to access gmail using the IMAP4 library. I'm using the connection string strport='ssl:host=imap.gmail.com:port=993' but it doesn't connect (timeout failure). The code is the mail_client function in this module https://github.com/quantmind/pulsar/blob/handshake/examples/webmail/manage.p... What am I doing wrong? Thanks Luca

On Sun, Feb 10, 2013 at 11:56 AM, Luca Sbardella <luca.sbardella@gmail.com>wrote: https://github.com/quantmind/pulsar/blob/handshake/examples/webmail/manage.p...
What am I doing wrong?
Have you tried a more isolated piece of test code, using only Twisted APIs and not pulsar's wrapper?

That works fine, it is pulsar that is not working ;-) It is a different question then, What the SSL connector does differently from a normal TCP connector? Or, better, what method should I fix/modify or add in the PulsarReactor https://github.com/quantmind/pulsar/blob/handshake/pulsar/lib/tx.py That reactor works fine for a standard tcp echo client. On 10 February 2013 20:56, Itamar Turner-Trauring < itamar@futurefoundries.com> wrote:

On Feb 10, 2013, at 2:15 PM, Luca Sbardella <luca.sbardella@gmail.com> wrote:
It looks like 'run' (A) overrides the base reactor's implementation, and (B) doesn't actually run the reactor. The Twisted reactor expects to 'own' the main loop, so you're skipping some of the initialization logic necessary to start a reactor up. I can't say why that would affect a TLS connection specifically, but internal state will be potentially inconsistent with this reactor implementation, and it's probably a more serious underlying problem that just happens to be initially visible with your TLS connection. -glyph P.S.: Please don't top-post :). https://en.wikipedia.org/wiki/Posting_style#Trimming_and_reformatting

It looks like 'run' (A) overrides the base reactor's implementation, and (B) doesn't actually run the reactor.
Correct, that is the intention, pulsar is the driver and the PulsarReactor is a proxy to one of pulsar event loops. it's probably a more serious underlying problem that just happens to be
initially visible with your TLS connection.
The main issue was the missing implementation of callFromThread and callInThread. I've also switched off signal handling, threads and scheduling, all handled by pulsar. https://github.com/quantmind/pulsar/blob/handshake/pulsar/lib/tx.py I'm now getting mailboxes via a websocket. Looking promising. https://github.com/quantmind/pulsar/blob/handshake/examples/webmail/manage.p... Luca

On Feb 11, 2013, at 3:37 PM, Luca Sbardella <luca.sbardella@gmail.com> wrote:
You need the signal handling for spawnProcess, unless you want to un-implement IReactorProcess. By all means implement it in terms of pulsar's existing support - that's the whole reason the reactor is documented in terms of abstract interfaces - but you need to implement it nonetheless :).
Cool, glad to hear this effort is progressing. -g

On Sun, Feb 10, 2013 at 11:56 AM, Luca Sbardella <luca.sbardella@gmail.com>wrote: https://github.com/quantmind/pulsar/blob/handshake/examples/webmail/manage.p...
What am I doing wrong?
Have you tried a more isolated piece of test code, using only Twisted APIs and not pulsar's wrapper?

That works fine, it is pulsar that is not working ;-) It is a different question then, What the SSL connector does differently from a normal TCP connector? Or, better, what method should I fix/modify or add in the PulsarReactor https://github.com/quantmind/pulsar/blob/handshake/pulsar/lib/tx.py That reactor works fine for a standard tcp echo client. On 10 February 2013 20:56, Itamar Turner-Trauring < itamar@futurefoundries.com> wrote:

On Feb 10, 2013, at 2:15 PM, Luca Sbardella <luca.sbardella@gmail.com> wrote:
It looks like 'run' (A) overrides the base reactor's implementation, and (B) doesn't actually run the reactor. The Twisted reactor expects to 'own' the main loop, so you're skipping some of the initialization logic necessary to start a reactor up. I can't say why that would affect a TLS connection specifically, but internal state will be potentially inconsistent with this reactor implementation, and it's probably a more serious underlying problem that just happens to be initially visible with your TLS connection. -glyph P.S.: Please don't top-post :). https://en.wikipedia.org/wiki/Posting_style#Trimming_and_reformatting

It looks like 'run' (A) overrides the base reactor's implementation, and (B) doesn't actually run the reactor.
Correct, that is the intention, pulsar is the driver and the PulsarReactor is a proxy to one of pulsar event loops. it's probably a more serious underlying problem that just happens to be
initially visible with your TLS connection.
The main issue was the missing implementation of callFromThread and callInThread. I've also switched off signal handling, threads and scheduling, all handled by pulsar. https://github.com/quantmind/pulsar/blob/handshake/pulsar/lib/tx.py I'm now getting mailboxes via a websocket. Looking promising. https://github.com/quantmind/pulsar/blob/handshake/examples/webmail/manage.p... Luca

On Feb 11, 2013, at 3:37 PM, Luca Sbardella <luca.sbardella@gmail.com> wrote:
You need the signal handling for spawnProcess, unless you want to un-implement IReactorProcess. By all means implement it in terms of pulsar's existing support - that's the whole reason the reactor is documented in terms of abstract interfaces - but you need to implement it nonetheless :).
Cool, glad to hear this effort is progressing. -g
participants (3)
-
Glyph
-
Itamar Turner-Trauring
-
Luca Sbardella