1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
6 <title>PycURL: CurlMulti Objects</title>
7 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
8 <meta name="revisit-after" content="30 days" />
9 <meta name="robots" content="noarchive, index, follow" />
13 <h1>CurlMulti Object</h1>
15 <p>CurlMulti objects have the following methods: </p>
18 <dt><code>close()</code> -> <em>None</em></dt>
21 <a href="http://curl.haxx.se/libcurl/c/curl_multi_cleanup.html"><code>curl_multi_cleanup()</code></a> in libcurl.
22 This method is automatically called by pycurl when a CurlMulti object no
23 longer has any references to it, but can also be called
27 <dt><code>perform()</code> -> <em>tuple of status and the number of active Curl objects</em></dt>
30 <a href="http://curl.haxx.se/libcurl/c/curl_multi_perform.html"><code>curl_multi_perform()</code></a> in libcurl.</p>
33 <dt><code> add_handle(</code><em>Curl object</em><code>) </code>-> <em>None</em></dt>
36 <a href="http://curl.haxx.se/libcurl/c/curl_multi_add_handle.html"><code>curl_multi_add_handle()</code></a> in libcurl.
37 This method adds an existing and valid Curl object to the CurlMulti
40 <p>IMPORTANT NOTE: add_handle does not implicitly add a Python reference
41 to the Curl object (and thus does not increase the reference count on the Curl
45 <dt><code>remove_handle(</code><em>Curl object</em><code>)</code> -> <em>None</em></dt>
48 <a href="http://curl.haxx.se/libcurl/c/curl_multi_remove_handle.html"><code>curl_multi_remove_handle()</code></a> in libcurl.
49 This method removes an existing and valid Curl object from the CurlMulti
52 <p>IMPORTANT NOTE: remove_handle does not implicitly remove a Python reference
53 from the Curl object (and thus does not decrease the reference count on the Curl
57 <dt><code>fdset()</code> ->
58 <em>triple of lists with active file descriptors,
59 readable, writeable, exceptions.</em></dt>
62 <a href="http://curl.haxx.se/libcurl/c/curl_multi_fdset.html"><code>curl_multi_fdset()</code></a> in libcurl.
63 This method extracts the file descriptor information from a CurlMulti object.
64 The returned lists can be used with the <code>select</code> module to
72 c.setopt(pycurl.URL, "http://curl.haxx.se")
73 m = pycurl.CurlMulti()
76 ret, num_handles = m.perform()
77 if ret != pycurl.E_CALL_MULTI_PERFORM: break
79 apply(select.select, m.fdset() + (1,))
81 ret, num_handles = m.perform()
82 if ret != pycurl.E_CALL_MULTI_PERFORM: break
86 <dt><code>select(</code><em>[timeout]</em><code>)</code> ->
87 <em>number of ready file descriptors or -1 on timeout</em></dt>
89 <p>This is a convenience function which simplifies the combined
90 use of <code>fdset()</code> and the <code>select</code> module.</p>
96 c.setopt(pycurl.URL, "http://curl.haxx.se")
97 m = pycurl.CurlMulti()
100 ret, num_handles = m.perform()
101 if ret != pycurl.E_CALL_MULTI_PERFORM: break
104 if ret == -1: continue
106 ret, num_handles = m.perform()
107 if ret != pycurl.E_CALL_MULTI_PERFORM: break
111 <dt><code>info_read(</code><em>[max]</em><code>)</code> ->
112 <em>numberof queued messages, a list of successful objects, a list of
113 failed objects</em></dt>
115 <p>Corresponds to the
116 <a href="http://curl.haxx.se/libcurl/c/curl_multi_info_read.html"><code>curl_multi_info_read()</code></a> function in libcurl.
117 This method extracts at most <em>max</em> messages
118 from the multi stack and returns them in two lists. The first
119 list contains the handles which completed successfully and the second
120 list contains a tuple <em><curl object, curl error number, curl
121 error message></em> for each failed curl object. The number
122 of queued messages after this method has been called is also
129 <a href="http://validator.w3.org/check/referer"><img align="right"
130 src="http://www.w3.org/Icons/valid-xhtml10"
131 alt="Valid XHTML 1.0!" height="31" width="88" border="0" /></a>
132 $Id: curlmultiobject.html,v 1.4 2004/06/05 17:59:01 mfx Exp $