Not using the specified site:
>>> import pywikibot >>> from pywikibot import pagegenerators >>> generatorFactory = pagegenerators.GeneratorFactory(pywikibot.Site('commons', 'commons')) >>> print('Default site is %s' % pywikibot.Site()) Default site is wikipedia:test >>> print('generatorFactory.site is %s' % generatorFactory.site) generatorFactory.site is commons:commons >>> generatorFactory.handleArg('-cat:User en') True >>> gen = generatorFactory.getCombinedGenerator() >>> print(len(list(gen))) 69 >>> # This is from wikipedia:test, instead of commons:commons.
Using the specified site:
>>> import pywikibot >>> from pywikibot import pagegenerators >>> generatorFactory = pagegenerators.GeneratorFactory(pywikibot.Site('commons', 'commons')) >>> print('Default site is %s' % pywikibot.Site()) Default site is wikipedia:test >>> print('generatorFactory.site is %s' % generatorFactory.site) generatorFactory.site is commons:commons >>> generatorFactory.handleArg('-prefixindex:File:BSicon_') True >>> gen = generatorFactory.getCombinedGenerator() >>> print(len(list(gen))) 32993 >>> # This is from commons:commons.
Version:
Pywikibot: [https] r-pywikibot-core.git (ef42bb1, g1, 2017/01/15, 16:38:36, n/a) Release version: 3.0-dev requests version: 2.2.1 cacerts: /etc/ssl/certs/ca-certificates.crt certificate test: ok Python: 3.4.0 (default, Jun 19 2015, 14:20:21) [GCC 4.8.2]