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&exp... ')
f = urllib2.urlopen(req, None, 300) print f.read()
...full page output...
This doesn't work (POST):
req = urllib2.Request('http://en.wikipedia.org/w/api.php',
'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!