On 30 September 2012 13:59, Itamar Turner-Trauring <span dir="ltr">&lt;<a href="mailto:itamar@futurefoundries.com" target="_blank">itamar@futurefoundries.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote"><div class="im">On Sun, Sep 30, 2012 at 8:38 AM, Paul Wiseman <span dir="ltr">&lt;<a href="mailto:poalman@gmail.com" target="_blank">poalman@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br><div class="gmail_quote"><div> That is likely a much better idea! Will I need to use some threading if I&#39;m making web calls then from list? Presumably if I don&#39;t the whole process will block while it&#39;s waiting for web responses?</div>

</div></blockquote></div><div><br>If you&#39;re using Twisted&#39;s web clients (getPage or the more complex but superior Agent) you do not need threads, Twisted will do the networking in a non-blocking manner. E.g.<br><br>
def list(self, path):<br>
    return twisted.web.client.getPage(...).addCallback(convertHTTPResponseToFTPListing)<span class="HOEnZb"><font color="#888888"><br><br></font></span></div></div><span class="HOEnZb"><font color="#888888">-- <br>Itamar Turner-Trauring, Future Foundries LLC<br>
<a href="http://futurefoundries.com/" target="_blank">http://futurefoundries.com/</a> — Twisted consulting, training and support.<br>
<br>
</font></span><br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br><div>I made an api for the web requests- the call isn&#39;t so straightforward, all the information is sent in POST formatted a certain way and there&#39;s also a credentials part with a token and other bits with secrets used to auth the request. So for instance I call the list dir method in the api and get back a Response type object based on the web response. Is there still way I can defer the returning of that web call, or would I need to tear the api apart to use twisted deferred objects internally? or is this something Agent could deal with?</div>