sending to mediawiki-api and bcc'ing wikitech-l; apologies for sending this
to the wrong list.
On Mon, Jun 21, 2010 at 1:03 PM, Eric Sun <esun(a)cs.stanford.edu> wrote:
Hi,
I'm trying to run action=query in Python with a POST request, but for some
reason it only works with a GET.
This works fine (GET):
>> req = urllib2.Request('
http://en.wikipedia.org/w/api.php?action=query&titles=The_Matrix&ex…
')
>> f = urllib2.urlopen(req, None, 300)
>> print f.read()
...full page output...
This doesn't work (POST):
'action=query&titles=The_Matrix&export&format=txt')
>> f = urllib2.urlopen(req, None, 300)
>> print f.read()
Array
(
[query] => Array
(
[normalized] => Array
(
[0] => Array
(
[from] => The_Matrix
[to] => The Matrix
)
)
[pages] => Array
(
[30007] => Array
(
[pageid] => 30007
[ns] => 0
[title] => The Matrix
)
)
)
)
Does anyone know what I'm doing wrong here?
Thanks in advance!