alexz-enwp / wikitools

Python package for working with MediaWiki wikis
105 stars 51 forks source link

Fall back from queryGen() to query() on versions with querycontinue only #56

Open nemobis opened 6 years ago

nemobis commented 6 years ago

Case in point: Wikia runs MediaWiki 1.19. I want to use queryGen() for https://github.com/WikiTeam/wikiteam/issues/311 to be future-proof, but I can't because it fails to pick up query-continue in a query like http://clubpenguin.wikia.com/api.php?action=query&prop=revisions&rvlimit=max&rvprop=ids&titles=Club%20Penguin%20Wiki&format=json:

{"query":{"pages":{"322415":{"pageid":322415,"ns":0,"title":"Club Penguin Wiki","revisions":[{"revid":1848307,"parentid":1839553},{"revid":1839553,"parentid":1820781},{"revid":1820781,"parentid":1819988},{"revid":1819988,"parentid":1819987},{"revid":1819987,"parentid":1818891},{"revid":1818891,"parentid":1818888},{"revid":1818888,"parentid":1775902},{"revid":1775902,"parentid":1775886},{"revid":1775886,"parentid":1775382},{"revid":1775382,"parentid":1775111},{"revid":1775111,"parentid":1775095},{"revid":1775095,"parentid":1774857},{"revid":1774857,"parentid":1774854},{"revid":1774854,"parentid":1760752},{"revid":1760752,"parentid":1759091},{"revid":1759091,"parentid":1759053},{"revid":1759053,"parentid":1759000},{"revid":1759000,"parentid":1758999},{"revid":1758999,"parentid":1758503},{"revid":1758503,"parentid":1758502},{"revid":1758502,"parentid":1746055},{"revid":1746055,"parentid":1699642},{"revid":1699642,"parentid":1699435},{"revid":1699435,"parentid":1693668},{"revid":1693668,"parentid":1661219},{"revid":1661219,"parentid":1658749},{"revid":1658749,"parentid":1646415},{"revid":1646415,"parentid":1623527},{"revid":1623527,"parentid":1611003},{"revid":1611003,"parentid":1583283},{"revid":1583283,"parentid":1546174},{"revid":1546174,"parentid":1379985},{"revid":1379985,"parentid":1287788},{"revid":1287788,"parentid":1287785},{"revid":1287785,"parentid":1256558},{"revid":1256558,"parentid":1243633},{"revid":1243633,"parentid":1164619},{"revid":1164619,"parentid":1128886},{"revid":1128886,"parentid":1033935},{"revid":1033935,"parentid":1026689},{"revid":1026689,"parentid":1017437},{"revid":1017437,"parentid":954007},{"revid":954007,"parentid":953176},{"revid":953176,"parentid":906139},{"revid":906139,"parentid":877864},{"revid":877864,"parentid":864038},{"revid":864038,"parentid":845901},{"revid":845901,"parentid":845898},{"revid":845898,"parentid":792557},{"revid":792557,"parentid":789571},{"revid":789571,"parentid":789566},{"revid":789566,"parentid":781192},{"revid":781192,"parentid":780170},{"revid":780170,"parentid":780167},{"revid":780167,"parentid":780155},{"revid":780155,"parentid":769644},{"revid":769644,"parentid":764426},{"revid":764426,"parentid":761996},{"revid":761996,"parentid":761875},{"revid":761875,"parentid":760284},{"revid":760284,"parentid":757484},{"revid":757484,"parentid":757480},{"revid":757480,"parentid":757479},{"revid":757479,"parentid":738107},{"revid":738107,"parentid":732325},{"revid":732325,"parentid":732290},{"revid":732290,"parentid":724684},{"revid":724684,"parentid":723477},{"revid":723477,"parentid":723363},{"revid":723363,"parentid":721204},{"revid":721204,"parentid":682376},{"revid":682376,"parentid":682373},{"revid":682373,"parentid":678775},{"revid":678775,"parentid":664775},{"revid":664775,"parentid":653761},{"revid":653761,"parentid":620484},{"revid":620484,"parentid":620475},{"revid":620475,"parentid":620473},{"revid":620473,"parentid":620472},{"revid":620472,"parentid":611551},{"revid":611551,"parentid":586355},{"revid":586355,"parentid":576017},{"revid":576017,"parentid":575848},{"revid":575848,"parentid":575708},{"revid":575708,"parentid":575541},{"revid":575541,"parentid":574997},{"revid":574997,"parentid":574202},{"revid":574202,"parentid":574201},{"revid":574201,"parentid":574200},{"revid":574200,"parentid":574196},{"revid":574196,"parentid":574194},{"revid":574194,"parentid":574192},{"revid":574192,"parentid":574184},{"revid":574184,"parentid":574181},{"revid":574181,"parentid":574180},{"revid":574180,"parentid":574177},{"revid":574177,"parentid":574174},{"revid":574174,"parentid":574173},{"revid":574173,"parentid":574172},{"revid":574172,"parentid":574171},{"revid":574171,"parentid":574170},{"revid":574170,"parentid":574168},{"revid":574168,"parentid":574166},{"revid":574166,"parentid":574165},{"revid":574165,"parentid":574164},{"revid":574164,"parentid":574163},{"revid":574163,"parentid":574162},{"revid":574162,"parentid":574161},{"revid":574161,"parentid":574160},{"revid":574160,"parentid":574159},{"revid":574159,"parentid":574158},{"revid":574158,"parentid":574157},{"revid":574157,"parentid":574156},{"revid":574156,"parentid":574155},{"revid":574155,"parentid":574153},{"revid":574153,"parentid":574152},{"revid":574152,"parentid":574150},{"revid":574150,"parentid":574148},{"revid":574148,"parentid":574147},{"revid":574147,"parentid":574146},{"revid":574146,"parentid":574145},{"revid":574145,"parentid":574144},{"revid":574144,"parentid":574143},{"revid":574143,"parentid":574142},{"revid":574142,"parentid":574141},{"revid":574141,"parentid":574140},{"revid":574140,"parentid":574139},{"revid":574139,"parentid":574133},{"revid":574133,"parentid":574132},{"revid":574132,"parentid":574128},{"revid":574128,"parentid":574121},{"revid":574121,"parentid":574035},{"revid":574035,"parentid":574034},{"revid":574034,"parentid":574033},{"revid":574033,"parentid":573811},{"revid":573811,"parentid":573810},{"revid":573810,"parentid":573806},{"revid":573806,"parentid":573802},{"revid":573802,"parentid":573793},{"revid":573793,"parentid":573791},{"revid":573791,"parentid":571555},{"revid":571555,"parentid":571551},{"revid":571551,"parentid":571180},{"revid":571180,"parentid":570619},{"revid":570619,"parentid":570618},{"revid":570618,"parentid":570550},{"revid":570550,"parentid":570480},{"revid":570480,"parentid":569282},{"revid":569282,"parentid":565470},{"revid":565470,"parentid":563969},{"revid":563969,"parentid":562772},{"revid":562772,"parentid":562455},{"revid":562455,"parentid":557875},{"revid":557875,"parentid":557822},{"revid":557822,"parentid":539247},{"revid":539247,"parentid":539240},{"revid":539240,"parentid":539237},{"revid":539237,"parentid":515559},{"revid":515559,"parentid":510764},{"revid":510764,"parentid":508277},{"revid":508277,"parentid":508266},{"revid":508266,"parentid":507361},{"revid":507361,"parentid":507109},{"revid":507109,"parentid":502625},{"revid":502625,"parentid":501895},{"revid":501895,"parentid":501892},{"revid":501892,"parentid":501882},{"revid":501882,"parentid":501881},{"revid":501881,"parentid":501879},{"revid":501879,"parentid":501823},{"revid":501823,"parentid":501822},{"revid":501822,"parentid":498076},{"revid":498076,"parentid":498063},{"revid":498063,"parentid":490417},{"revid":490417,"parentid":486863},{"revid":486863,"parentid":485332},{"revid":485332,"parentid":485331},{"revid":485331,"parentid":484004},{"revid":484004,"parentid":483947},{"revid":483947,"parentid":483946},{"revid":483946,"parentid":483945},{"revid":483945,"parentid":483940},{"revid":483940,"parentid":483934},{"revid":483934,"parentid":483933},{"revid":483933,"parentid":483932},{"revid":483932,"parentid":482742},{"revid":482742,"parentid":481876},{"revid":481876,"parentid":480224},{"revid":480224,"parentid":480223},{"revid":480223,"parentid":478770},{"revid":478770,"parentid":478289},{"revid":478289,"parentid":478288},{"revid":478288,"parentid":477971},{"revid":477971,"parentid":475826},{"revid":475826,"parentid":473220},{"revid":473220,"parentid":473058},{"revid":473058,"parentid":473056},{"revid":473056,"parentid":473041},{"revid":473041,"parentid":437724},{"revid":437724,"parentid":437309},{"revid":437309,"parentid":429923},{"revid":429923,"parentid":420771},{"revid":420771,"parentid":417103},{"revid":417103,"parentid":403727},{"revid":403727,"parentid":403715},{"revid":403715,"parentid":368926},{"revid":368926,"parentid":368845},{"revid":368845,"parentid":368619},{"revid":368619,"parentid":368613},{"revid":368613,"parentid":368567},{"revid":368567,"parentid":368550},{"revid":368550,"parentid":368164},{"revid":368164,"parentid":367637},{"revid":367637,"parentid":350635},{"revid":350635,"parentid":350524},{"revid":350524,"parentid":350520},{"revid":350520,"parentid":350519},{"revid":350519,"parentid":350517},{"revid":350517,"parentid":350516},{"revid":350516,"parentid":350222},{"revid":350222,"parentid":350217},{"revid":350217,"parentid":348061},{"revid":348061,"parentid":339095},{"revid":339095,"parentid":338837},{"revid":338837,"parentid":336813},{"revid":336813,"parentid":336655},{"revid":336655,"parentid":336055},{"revid":336055,"parentid":336035},{"revid":336035,"parentid":336020},{"revid":336020,"parentid":334001},{"revid":334001,"parentid":333951},{"revid":333951,"parentid":333502},{"revid":333502,"parentid":333501},{"revid":333501,"parentid":333500},{"revid":333500,"parentid":333499},{"revid":333499,"parentid":327675},{"revid":327675,"parentid":324410},{"revid":324410,"parentid":324407},{"revid":324407,"parentid":324406},{"revid":324406,"parentid":324402},{"revid":324402,"parentid":324398},{"revid":324401,"parentid":324398},{"revid":324398,"parentid":324393},{"revid":324393,"parentid":324352},{"revid":324352,"parentid":324103},{"revid":324103,"parentid":320868},{"revid":320868,"parentid":314109},{"revid":314109,"parentid":314108},{"revid":314108,"parentid":314072},{"revid":314072,"parentid":313106},{"revid":313106,"parentid":313105},{"revid":313105,"parentid":309757},{"revid":309757,"parentid":301273},{"revid":301273,"parentid":298365},{"revid":298365,"parentid":298203},{"revid":298203,"parentid":298129},{"revid":298129,"parentid":298024},{"revid":298024,"parentid":298020},{"revid":298020,"parentid":298018},{"revid":298018,"parentid":298015},{"revid":298015,"parentid":297855},{"revid":297855,"parentid":297735},{"revid":297735,"parentid":297709},{"revid":297709,"parentid":297064},{"revid":297064,"parentid":296276},{"revid":296276,"parentid":296067},{"revid":296067,"parentid":296065},{"revid":296065,"parentid":295867},{"revid":295867,"parentid":295861},{"revid":295861,"parentid":295858},{"revid":295858,"parentid":295783},{"revid":295783,"parentid":295782},{"revid":295782,"parentid":295780},{"revid":295780,"parentid":295778},{"revid":295778,"parentid":295777},{"revid":295777,"parentid":295774},{"revid":295774,"parentid":295770},{"revid":295770,"parentid":295767},{"revid":295767,"parentid":295739},{"revid":295739,"parentid":295737},{"revid":295737,"parentid":295736},{"revid":295736,"parentid":295732},{"revid":295732,"parentid":295729},{"revid":295729,"parentid":295728},{"revid":295728,"parentid":295721},{"revid":295721,"parentid":295717},{"revid":295717,"parentid":294237},{"revid":294237,"parentid":293717},{"revid":293717,"parentid":293068},{"revid":293068,"parentid":293066},{"revid":293066,"parentid":291766},{"revid":291766,"parentid":291691},{"revid":291691,"parentid":291466},{"revid":291466,"parentid":291380},{"revid":291380,"parentid":291324},{"revid":291324,"parentid":291321},{"revid":291321,"parentid":291319},{"revid":291319,"parentid":291318},{"revid":291318,"parentid":291303},{"revid":291303,"parentid":291292},{"revid":291292,"parentid":291143},{"revid":291143,"parentid":291139},{"revid":291139,"parentid":291136},{"revid":291136,"parentid":291135},{"revid":291135,"parentid":290431},{"revid":290431,"parentid":290430},{"revid":290430,"parentid":290428},{"revid":290428,"parentid":290417},{"revid":290417,"parentid":288896},{"revid":288896,"parentid":288858},{"revid":288858,"parentid":288822},{"revid":288822,"parentid":288821},{"revid":288821,"parentid":287531},{"revid":287531,"parentid":287011},{"revid":287011,"parentid":287010},{"revid":287010,"parentid":287004},{"revid":287004,"parentid":287003},{"revid":287003,"parentid":286941},{"revid":286941,"parentid":286937},{"revid":286937,"parentid":286936},{"revid":286936,"parentid":286387},{"revid":286387,"parentid":286381},{"revid":286381,"parentid":286372},{"revid":286372,"parentid":281874},{"revid":281874,"parentid":281869},{"revid":281869,"parentid":281849},{"revid":281849,"parentid":281393},{"revid":281393,"parentid":281379},{"revid":281379,"parentid":281378},{"revid":281378,"parentid":281368},{"revid":281368,"parentid":273457},{"revid":273457,"parentid":273456},{"revid":273456,"parentid":273453},{"revid":273453,"parentid":271598},{"revid":271598,"parentid":271004},{"revid":271004,"parentid":270627},{"revid":270627,"parentid":270626},{"revid":270626,"parentid":270550},{"revid":270550,"parentid":270549},{"revid":270549,"parentid":270546},{"revid":270546,"parentid":270475},{"revid":270475,"parentid":270472},{"revid":270472,"parentid":269544},{"revid":269544,"parentid":268812},{"revid":268812,"parentid":268785},{"revid":268785,"parentid":267665},{"revid":267665,"parentid":267630},{"revid":267630,"parentid":266852},{"revid":266852,"parentid":266805},{"revid":266805,"parentid":266804},{"revid":266804,"parentid":266244},{"revid":266244,"parentid":266241},{"revid":266241,"parentid":265177},{"revid":265177,"parentid":265158},{"revid":265158,"parentid":265147},{"revid":265147,"parentid":265073},{"revid":265073,"parentid":265070},{"revid":265070,"parentid":261992},{"revid":261992,"parentid":261991},{"revid":261991,"parentid":261460},{"revid":261460,"parentid":261459},{"revid":261459,"parentid":261401},{"revid":261401,"parentid":261293},{"revid":261293,"parentid":261282},{"revid":261282,"parentid":261099},{"revid":261099,"parentid":261012},{"revid":261012,"parentid":261011},{"revid":261011,"parentid":261009},{"revid":261009,"parentid":260993},{"revid":260993,"parentid":260989},{"revid":260989,"parentid":260988},{"revid":260988,"parentid":260788},{"revid":260788,"parentid":260716},{"revid":260716,"parentid":259514},{"revid":259514,"parentid":258945},{"revid":258945,"parentid":257630},{"revid":257630,"parentid":256994},{"revid":256994,"parentid":256823},{"revid":256823,"parentid":253257},{"revid":253257,"parentid":251917},{"revid":251917,"parentid":251864},{"revid":251864,"parentid":251259},{"revid":251259,"parentid":249912},{"revid":249912,"parentid":249201},{"revid":249201,"parentid":249185},{"revid":249185,"parentid":249152},{"revid":249152,"parentid":249140},{"revid":249140,"parentid":249130},{"revid":249130,"parentid":249127},{"revid":249127,"parentid":249114},{"revid":249114,"parentid":249113},{"revid":249113,"parentid":249112},{"revid":249112,"parentid":249111},{"revid":249111,"parentid":249108},{"revid":249108,"parentid":248985},{"revid":248985,"parentid":248961},{"revid":248961,"parentid":248750},{"revid":248750,"parentid":247945},{"revid":247945,"parentid":247944},{"revid":247944,"parentid":247776},{"revid":247776,"parentid":247770},{"revid":247770,"parentid":247589},{"revid":247589,"parentid":247385},{"revid":247385,"parentid":247283},{"revid":247283,"parentid":247277},{"revid":247277,"parentid":247117},{"revid":247117,"parentid":247048},{"revid":247048,"parentid":246980},{"revid":246980,"parentid":246975},{"revid":246975,"parentid":246396},{"revid":246396,"parentid":245936},{"revid":245936,"parentid":245867},{"revid":245867,"parentid":245866},{"revid":245866,"parentid":245861},{"revid":245861,"parentid":245576},{"revid":245576,"parentid":245575},{"revid":245575,"parentid":245574},{"revid":245574,"parentid":245428},{"revid":245428,"parentid":245424},{"revid":245424,"parentid":245197},{"revid":245197,"parentid":245193},{"revid":245193,"parentid":245190},{"revid":245190,"parentid":245165},{"revid":245165,"parentid":245043},{"revid":245043,"parentid":245042},{"revid":245042,"parentid":245040},{"revid":245040,"parentid":245039},{"revid":245039,"parentid":245038},{"revid":245038,"parentid":245037},{"revid":245037,"parentid":245036},{"revid":245036,"parentid":244991},{"revid":244991,"parentid":244464},{"revid":244464,"parentid":244463},{"revid":244463,"parentid":244462},{"revid":244462,"parentid":243871},{"revid":243871,"parentid":243868},{"revid":243868,"parentid":243867},{"revid":243867,"parentid":243866},{"revid":243866,"parentid":243863},{"revid":243863,"parentid":243862},{"revid":243862,"parentid":243484},{"revid":243484,"parentid":243476},{"revid":243476,"parentid":243475},{"revid":243475,"parentid":243472},{"revid":243472,"parentid":243267},{"revid":243267,"parentid":243264},{"revid":243264,"parentid":243204},{"revid":243204,"parentid":243202},{"revid":243202,"parentid":243200},{"revid":243200,"parentid":243199},{"revid":243199,"parentid":243197},{"revid":243197,"parentid":243185},{"revid":243185,"parentid":243184},{"revid":243184,"parentid":243180},{"revid":243180,"parentid":243177},{"revid":243177,"parentid":242616},{"revid":242616,"parentid":241618},{"revid":241618,"parentid":240817},{"revid":240817,"parentid":240816},{"revid":240816,"parentid":240714},{"revid":240714,"parentid":240520},{"revid":240520,"parentid":240519},{"revid":240519,"parentid":240481},{"revid":240481,"parentid":240479},{"revid":240479,"parentid":239504},{"revid":239504,"parentid":239311},{"revid":239311,"parentid":239199},{"revid":239199,"parentid":239194},{"revid":239194,"parentid":239193},{"revid":239193,"parentid":239141},{"revid":239141,"parentid":238770},{"revid":238770,"parentid":237355},{"revid":237355,"parentid":236560},{"revid":236560,"parentid":236557},{"revid":236557,"parentid":236219},{"revid":236219,"parentid":235449},{"revid":235449,"parentid":235410},{"revid":235410,"parentid":234860},{"revid":234860,"parentid":234842},{"revid":234842,"parentid":233240},{"revid":233240,"parentid":232578},{"revid":232578,"parentid":232577},{"revid":232577,"parentid":232470},{"revid":232470,"parentid":232360},{"revid":232360,"parentid":232180},{"revid":232180,"parentid":232178},{"revid":232178,"parentid":232176},{"revid":232176,"parentid":232175},{"revid":232175,"parentid":232172},{"revid":232172,"parentid":232169},{"revid":232169,"parentid":232165},{"revid":232165,"parentid":232114},{"revid":232114,"parentid":232113},{"revid":232113,"parentid":232109},{"revid":232109,"parentid":231996},{"revid":231996,"parentid":231537},{"revid":231537,"parentid":231525},{"revid":231525,"parentid":231271},{"revid":231271,"parentid":230656},{"revid":230656,"parentid":230575}]}}},"limits":{"revisions":500},"query-continue":{"revisions":{"rvstartid":230575}}}

I expected wikitools to fall back to the "correct" method depending on what's available.