Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Pycurl is a pretty thin wrapper for libcurl. If you can do it with libcurl, you can do it with pycurl. (Mostly.)</p> <p>For instance:</p> <blockquote> <p>pycurl.setopt corresponds to curl_easy_setopt in libcurl, where option is specified with the CURLOPT_* constants in libcurl, except that the CURLOPT_ prefix has been removed.</p> </blockquote> <p>See: <a href="http://pycurl.sourceforge.net/doc/curlobject.html" rel="nofollow">http://pycurl.sourceforge.net/doc/curlobject.html</a></p> <p>That being said, the <code>curl -d</code> option is for sending HTTP POST requests... not the GET style your example shows.</p> <p>libcurl does expect that urls it recives already be URL encoded. Just use <a href="http://docs.python.org/library/urllib.html" rel="nofollow">http://docs.python.org/library/urllib.html</a> if needed.</p> <p>The sample URL in your question already has 2 parameters (userId and page). </p> <p>In general the format is: URL followed by a 'question mark', followed by name=value pairs joined by an ampersand symbol. If the name or value contain special chars, you will need to percent-encoded them.</p> <p>Just use the urlencode function:</p> <pre><code>&gt;&gt;&gt; import urllib &gt;&gt;&gt; params = [('name1','value1'), ('name2','value2 with spaces &amp; stuff')] &gt;&gt;&gt; pairs = urllib.urlencode(params) &gt;&gt;&gt; fullurl = 'http://status.dummy.com/status.json' + '?' + pairs &gt;&gt;&gt; print fullurl http://status.dummy.com/status.json?name1=value1&amp;name2=value2+with+spaces+%26+stuff &gt;&gt;&gt; </code></pre> <p>Also, see the <code>urllib.urlopen</code> function. Perhaps you do not need curl at all? (But I do not know your application...)</p> <p><strong>Hope this helps.</strong> If so, mark answered and let me know. :-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload