@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# dumpgenerator.py A generator of dumps for wikis
# dumpgenerator.py A generator of dumps for wikis
# Copyright (C) 2011-201 6 WikiTeam developers
# Copyright (C) 2011-201 8 WikiTeam developers
# This program is free software: you can redistribute it and/or modify
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# the Free Software Foundation, either version 3 of the License, or
@ -396,16 +396,11 @@ def getPageTitles(config={}, session=None):
titles = [ ]
titles = [ ]
if ' api ' in config and config [ ' api ' ] :
if ' api ' in config and config [ ' api ' ] :
r = session . post ( config [ ' api ' ] , params = { ' action ' : ' query ' , ' list ' : ' allpages ' , ' format ' : ' json ' } , timeout = 30 )
try :
try :
t est = getJSON ( r )
t itles = getPageTitlesAPI ( config = config , session = session )
except :
except :
test = None
print " Error: could not get page titles from the API "
if not test or ( ' warnings ' in test and ' allpages ' in test [ ' warnings ' ] and ' * ' in test [ ' warnings ' ] [ ' allpages ' ]
and test [ ' warnings ' ] [ ' allpages ' ] [ ' * ' ] == ' The " allpages " module has been disabled. ' ) :
titles = getPageTitlesScraper ( config = config , session = session )
titles = getPageTitlesScraper ( config = config , session = session )
else :
titles = getPageTitlesAPI ( config = config , session = session )
elif ' index ' in config and config [ ' index ' ] :
elif ' index ' in config and config [ ' index ' ] :
titles = getPageTitlesScraper ( config = config , session = session )
titles = getPageTitlesScraper ( config = config , session = session )