I create a query to get the redirect links in a page using the following:
params = {'action':'query',
'generator':'links',
'gpllimit':'10',
'pageids':pageid,
'redirects':''
}
req = api.APIRequest(globalsite, params)
res = req.query(querycontinue=True)
This works fine as long as the page has any links, but it gets in an endless
loop in api.py if there are no links in the page.
Basically the problem is the following lines. The data is initially false, and
following the call to __parseJSON it is an empty list []. Because and empty
list counts as true for the loop, this continues forever.
while not data:
rawdata = self.__getRaw()
data = self.__parseJSON(rawdata)
Version is relatively recent - sorry, can't tell you exactly what
Original issue reported on code.google.com by hamishwi...@gmail.com on 25 Jul 2012 at 4:44
Original issue reported on code.google.com by
hamishwi...@gmail.com
on 25 Jul 2012 at 4:44