Actually use the next batch from prop=revisions in MediaWiki 1.19

pull/367/head
Federico Leva 4 years ago
parent 2ba69b3810
commit 6dc86d1964

@ -962,14 +962,14 @@ def getXMLRevisions(config={}, session=None, allpages=False):
config['http_method'] = "GET" config['http_method'] = "GET"
exportrequest = site.api(http_method=config['http_method'], **exportparams) exportrequest = site.api(http_method=config['http_method'], **exportparams)
# The array is called "pages" even if there's only one.
# TODO: we could actually batch titles a bit here if desired. How many?
try:
pages = prequest['query']['pages']
except KeyError:
raise PageMissingError(title, xml='')
# Be ready to iterate if there is continuation. # Be ready to iterate if there is continuation.
while True: while True:
# The array is called "pages" even if there's only one.
# TODO: we could actually batch titles a bit here if desired. How many?
try:
pages = prequest['query']['pages']
except KeyError:
raise PageMissingError(title, xml='')
# Go through the data we got to build the XML. # Go through the data we got to build the XML.
for pageid in pages: for pageid in pages:
try: try:

Loading…
Cancel
Save