[Twisted-web] HTTP POST from SMTP server

James Brady rent.lupin.road at gmail.com
Sat Dec 8 19:17:28 EST 2007


> >        client =3D getPage(url=3D'http://localhost:8080/message_event_no=
tify
> ',
> >method=3D'POST',
> >            postdata=3Durlencode(postdata),
> >            headers=3D{ 'Content-Type': 'application/x-www-form-urlencod=
ed'
> }
> >)
> >        client.addCallback(self.success)
> >        client.addErrback(self.failure)
> >        reactor.run()
> >
>
> You don't need to call reactor.run() here - the reactor is already running
> (that's how the SMTP server works, after all).  In fact, you can't call
> reactor.run() here - the reactor mainloop is not reentrant.
>
> Instead, you probably want to return the "client" Deferred from
> eomReceived.
> The SMTP protocol code will use that Deferred to know when to indicate to
> the SMTP client which is talking to it when the message has been delivered
> successful or if there is an error.


OK, yes that makes sense - it works great with that change.

Thanks
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20071209/15=
14c7fe/attachment.htm


More information about the Twisted-web mailing list