Pycurl is a pretty thin wrapper for libcurl. If you can do it with libcurl, you can do it with pycurl. (Mostly.)
For instance:
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.
See: http://pycurl.sourceforge.net/doc/curlobject.html
That being said, the curl -d
option is for sending HTTP POST requests... not the GET style your example shows.
libcurl does expect that urls it recives already be URL encoded. Just use http://docs.python.org/library/urllib.html if needed.
The sample URL in your question already has 2 parameters (userId and page).
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.
Just use the urlencode function:
>>> import urllib
>>> params = [('name1','value1'), ('name2','value2 with spaces & stuff')]
>>> pairs = urllib.urlencode(params)
>>> fullurl = 'http://status.dummy.com/status.json' + '?' + pairs
>>> print fullurl
http://status.dummy.com/status.json?name1=value1&name2=value2+with+spaces+%26+stuff
>>>
Also, see the urllib.urlopen
function. Perhaps you do not need curl at all? (But I do not know your application...)
Hope this helps. If so, mark answered and let me know. :-)