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@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&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!
On Mon, Jun 21, 2010 at 01:09:23PM -0700, Eric Sun wrote:
This doesn't work (POST):
req = urllib2.Request('http://en.wikipedia.org/w/api.php',
'action=query&titles=The_Matrix&export&format=txt')
Try "export=1" instead of just "export".
That did the trick. Thanks!
On Mon, Jun 21, 2010 at 1:24 PM, Brad Jorsch b-jorsch@northwestern.eduwrote:
On Mon, Jun 21, 2010 at 01:09:23PM -0700, Eric Sun wrote:
This doesn't work (POST):
req = urllib2.Request('http://en.wikipedia.org/w/api.php',
'action=query&titles=The_Matrix&export&format=txt')
Try "export=1" instead of just "export".
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org