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: Curl 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" />
15 <p>Curl 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_easy_cleanup.html"><code>curl_easy_cleanup</code></a> in libcurl.
22 This method is automatically called by pycurl when a Curl object no longer has
23 any references to it, but can also be called explicitly.</p>
26 <dt><code>perform()</code> -> <em>None</em></dt>
29 <a href="http://curl.haxx.se/libcurl/c/curl_easy_perform.html"><code>curl_easy_perform</code></a> in libcurl.</p>
32 <dt><code>setopt(</code><em>option, value</em><code>)</code> -> <em>None</em></dt>
36 <a href="http://curl.haxx.se/libcurl/c/curl_easy_setopt.html"><code>curl_easy_setopt</code></a> in libcurl, where
37 <em>option</em> is specified with the CURLOPT_* constants in libcurl,
38 except that the CURLOPT_ prefix has been removed. The type for
39 <em>value</em> depends on the option, and can be either a string,
40 integer, long integer, file objects, lists, or functions.</p>
47 c.setopt(pycurl.URL, "http://www.python.org/")
48 c.setopt(pycurl.HTTPHEADER, ["Accept:"])
50 b = StringIO.StringIO()
51 c.setopt(pycurl.WRITEFUNCTION, b.write)
52 c.setopt(pycurl.FOLLOWLOCATION, 1)
53 c.setopt(pycurl.MAXREDIRS, 5)
60 <dt><code>getinfo(</code><em>option</em><code>) </code>-> <em>Result</em></dt>
64 <a href="http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html"><code>curl_easy_getinfo</code></a> in libcurl, where
65 <em>option</em> is the same as the CURLINFO_* constants in libcurl,
66 except that the CURLINFO_ prefix has been removed.
67 <em>Result</em> contains an integer, float or string, depending on
68 which option is given. The <code>getinfo</code> method should
69 not be called unless <code>perform</code> has been called and
77 c.setopt(pycurl.URL, "http://sf.net")
78 c.setopt(pycurl.FOLLOWLOCATION, 1)
80 print c.getinfo(pycurl.HTTP_CODE), c.getinfo(pycurl.EFFECTIVE_URL)
82 --> 200 "http://sourceforge.net/"
86 <dt><code>errstr()</code> -> <em>String</em></dt>
88 <p>Returns the internal libcurl error buffer of this handle as a string.</p>
95 <a href="http://validator.w3.org/check/referer"><img align="right"
96 src="http://www.w3.org/Icons/valid-xhtml10"
97 alt="Valid XHTML 1.0!" height="31" width="88" border="0" /></a>