import pywikibot
site = pywikibot.Site('test','wikipedia')
site
APISite("test", "wikipedia")
site2 = pywikibot.Site('test','wiktionary')
---------------------------------------------------------------------------
UnknownSite                               Traceback (most recent call last)
<ipython-input-5-7bf0c22adfc3> in <module>()
----> 1 site2 = pywikibot.Site('test','wiktionary')

/srv/paws/lib/python3.4/site-packages/pywikibot/__init__.py in Site(code, fam, user, sysop, interface, url)
    814     key = '%s:%s:%s:%s' % (interface.__name__, fam, code, user)
    815     if key not in _sites or not isinstance(_sites[key], interface):
--> 816         _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
    817         debug(u"Instantiated %s object '%s'"
    818               % (interface.__name__, _sites[key]), _logger)

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in __init__(self, code, fam, user, sysop)
   1853     def __init__(self, code, fam=None, user=None, sysop=None):
   1854         """Constructor."""
-> 1855         BaseSite.__init__(self, code, fam, user, sysop)
   1856         self._msgcache = {}
   1857         self._loginstatus = LoginStatus.NOT_ATTEMPTED

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in __init__(self, code, fam, user, sysop)
    771             else:
    772                 raise UnknownSite(u"Language '%s' does not exist in family %s"
--> 773                                   % (self.__code, self.__family.name))
    774 
    775         self._username = [normalize_username(user), normalize_username(sysop)]

UnknownSite: Language 'test' does not exist in family wiktionary
site
APISite("test", "wikipedia")
page = pywikibot.Page(site,'test'
                     )
page
Page('Test')
page.exists()
True
page.text
'Hello world!'
page.address
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-4d6ddd1897bf> in <module>()
----> 1 page.address

AttributeError: 'Page' object has no attribute 'address'
page
Page('Test')
page.categories
<bound method Page.categories of Page('Test')>
page
page.text
'Hello world!'
page.text = "c'est mon tests"
page.save()
Page [[Test]] saved
page2 = pywikibot.Page(site, 'test')
page2.text
"c'est mon tests"
page2.exists() https://en.wiktionary.org/wiki/ahig%C4%85%CC%81
True
site=pywikibot.Site('en','wiktionary')
page = pywikibot.Page(site,'diigis')
page.text
"==Navajo==\n\n===Etymology===\n{{nv-prefixes|di-inceptive|yi-trans|3s|d}}  {{nv-link-to-stem|-gis|neuter perfective}} {{nv-link-to-root|-GIZ|twist}}. \n \n===Verb===\n{{head|nv|verb}}\n\n# he/she/it is [[stupid]]\n# he/she/it is [[clumsy]]\n# First-person duoplural imperfective form of diigis\n\n====Usage notes====\nThis is a neuter verb that uses only the yii-perfective mode.\n\n====Conjugation====\n{{nv-paradigm|neuter perfective|yii}}. \n{{nv-verbtable|IMPERFECTIVE\n|diisgis|diigis|dadiigis|dinigis|doohgis|dadoohgis|diigis|dadiigis|jidiigis|dazhdiigis}}\n\n'''Note''': This verb has been variously described by Young (1987) as a Ø-classifier/yii-imperfective, and Young (1992) as a Ø-classifier/yii-perfective. \n\nIt is here rather described as a d-classifier/yii-perfective, which is the only combination that accounts for both the -''iis'' ending in the 1sg (as per the d-classifier; the Ø- classifier would give -''ii'') and the -''ini'' ending in the 2sg (as per the yii-perfective; the yii-imperfective would give -''ii'')."
c = page.categories()
c
<pywikibot.data.api.PageGenerator at 0x7fcc6c1370b8>
cat = pywikibot.Category(site,'Category:Navajo irregular vers')
from pywikibot import pagegenerators
gen = pagegenerators.CategorizedPageGenerator(cat)
for page in gen:
    page.text
cat = pywikibot.Category(site,'Category:Navajo irregular verbs')
cat.exists()
True
gen = pagegenerators.CategorizedPageGenerator(cat)
gen
<generator object CategorizedPageGenerator at 0x7fcc57196240>
list(gen)
[Page('adiníłdíín'),
 Page('ałtso'),
 Page('bihónéedząąh'),
 Page('chʼéghááh'),
 Page('didzééh'),
 Page('déesxéél'),
 Page('ánéídlééh'),
 Page('ászólí'),
 Page('ílį́')]
for page in gen:
    text = page.text
    
text
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-57-e1cbb0c3879a> in <module>()
----> 1 text

NameError: name 'text' is not defined
list(gen)
[]
gen = pagegenerators.CategorizedPageGenerator(cat)
for page in gen:
    page.text
    
    
len(gen)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-62-cd0a70738f47> in <module>()
----> 1 len(gen)

TypeError: object of type 'generator' has no len()
list(gen)
[Page('adiníłdíín'),
 Page('ałtso'),
 Page('bihónéedząąh'),
 Page('chʼéghááh'),
 Page('didzééh'),
 Page('déesxéél'),
 Page('ánéídlééh'),
 Page('ászólí'),
 Page('ílį́')]
list(gen)
[]
gen = pagegenerators.CategorizedPageGenerator(cat)
for page in gen:
    page.exists()
list(gen)
[Page('adiníłdíín'),
 Page('ałtso'),
 Page('bihónéedząąh'),
 Page('chʼéghááh'),
 Page('didzééh'),
 Page('déesxéél'),
 Page('ánéídlééh'),
 Page('ászólí'),
 Page('ílį́')]
text = ""
for page in gen:
    text += page.text
    
text
'==Navajo==\n\n===Etymology===\n{{nv-prefixes|a|di-fire|yíní|3s|L}} {{nv-link-to-stem |-díín}} {{nv-link-to-root  |-DÍÍN|light|light shines}}\n\n===Verb===\n{{head|nv|verb}}\n\n# he/she/it is [[direct#Verb|directing]], [[cast#Verb|casting]] or [[reflect#Verb|reflect]]ing light\n\n====Usage notes====\nThis is a neuter verb that uses only the imperfective mode.\n\n====Conjugation====\n{{nv-paradigm|neuter imperfective||irregular}}\n{{nv-verbtable|IMPERFECTIVE\n|adííníshdíín|adííníildíín|daʼdííníildíín|adííníłdíín|adíínółdíín|daʼdíínółdíín|adiníłdíín|daʼdiníłdíín|adizhníłdíín|dazhdiʼníłdíín}}\n\n====Related terms====\n* {{l|nv|sháńdíín}}\n* {{l|nv|adinídíín}} \n\n[[Category:nv:Light]]==Navajo==\n===Etymology===\n{{nv-prefixes|á-comp|ni-them|l}} {{nv-link-to-stem|-tso}} {{nv-link-to-root|-TSOH|big|to be big}}\n\n===Verb===\n{{head|nv|verb}}\n\n# all [[completed]], [[finished]]\n# all of it\n# [[entirely]]\n\n====Conjugation====\n{{nv-paradigm|neuter imperfective|ni|irr}}\n[[Category:Navajo verbs : plural only]] \n{{nv-verbtable|PERFECTIVE\n|-|tʼáá áníiltso|? |-|tʼáá ánółtso|? |tʼáá ałtso|? |tʼáá ájíłtso|?}}\nall of us (3+), all of you (3+), all of them (3+), all of it, everyone, everybody.==Navajo==\n\n===Etymology===\n{{nv-prefixes |b|ho|ní-comp|ni-term|3s|d}} {{nv-link-to-stem |-dząąh}} {{nv-link-to-root |-DZĄĄD|possible|to be possible}}.\n\nThe stem may actually be [[-ząąh]], potentially ultimately deriving from the root {{m|nv|-YĄĄD}} ("to be wise", see {{m|nv|honisą}}/{{m|nv|hóyą}}). Compare Chipewyan {{l|chp|hurélyą||good weather}} and Sarcee {{l|srs|-dhzoh|nanidhzoh|get well}}.\n\nOther difficulties are the origin of the high tone on {{m|nv|ho-}} and the pre-stem long \'\'-née-\'\' (possibly from {{m|nv|ní-}} + {{m|nv|ni-}} ?), only found in few other bases (see {{m|nv|ánéeltʼeʼ}}).\n\n===Verb===\n{{head|nv|verb}}\n\n# it becomes [[possible]]\n# it becomes [[practical]], [[feasible]]\n\n====Usage notes====\nThis verb is semantically limited to expression in the third person.\n\n====Conjugation====\n[[Category:Navajo irregular verbs]] \n{| style="margin-bottom:.1em; margin-right:1em;width:24.5em; border:1px solid #AAAAAA; border-collapse:collapse;" cellpadding="4" rules="all"\n!bgcolor=#EFEAAA align=left style="font-size:90%;"|IMPERFECTIVE\n!bgcolor=#EFEFFF align=center WIDTH="166" style="font-size:90%;"|singular\n|-\n!bgcolor=#EFEFFF align=left style="font-size:90%;"|3rd person\n|align=center|bihónéedząąh\n|}\n{| style="margin-bottom:.1em; margin-right:1em;width:24.5em; border:1px solid #AAAAAA; border-collapse:collapse;" cellpadding="4" rules="all"\n!bgcolor=#EFEAAA align=left style="font-size:90%;"|NEUTER \n!bgcolor=#EFEFFF align=center WIDTH="166" style="font-size:90%;"|singular\n|-\n!bgcolor=#EFEFFF align=left style="font-size:90%;"|3rd person\n|align=center|[[bihónéedzą́]]\n|}\n{| style="margin-bottom:1em; margin-right:1em;width:24.5em; border:1px solid #AAAAAA; border-collapse:collapse;" cellpadding="4" rules="all"\n!bgcolor=#EFEAAA align=left style="font-size:90%;"|PERFECTIVE\n!bgcolor=#EFEFFF align=center WIDTH="166" style="font-size:90%;"|singular\n|-\n!bgcolor=#EFEFFF align=left style="font-size:90%;"|3rd person\n|align=center|[[bihónéesdząąd]]\n|}==Navajo==\n===Etymology===\n{{nv-prefixes|chʼí|ni|3s}} + {{nv-prefixes |-}} {{nv-link-to-stem|-ááh}} {{nv-link-to-root |-YÁ|go|to go, to walk  —1 actor}}.\n\nPrefix {{m|nv|chʼí-}} becomes \'\'chʼé\'\'- when in pre-stem position. \n\n===Verb===\n{{head|nv|verb}}\n# he/she [[go]]es out horizontally (as through a door), [[exit]]s, [[leave]]s.\n\n====Usage notes====\nThis stem is used for going / walking individually. For movement in pairs, see {{m|nv|chʼéʼaash}}. For movement in groups of three or more, see {{m|nv|chʼékááh}}.\n\nPlural forms of this verb refer to several people going independently one from another: \n:*\'\'\'Chʼíniidzá\'\'\'  — \'\'each of us went out\'\'.\n:*Nihí łaʼ \'\'\'chʼínooyá\'\'\'  — \'\'one of you went out\'\'.\n:*\'\'\'Chʼídahaadzá\'\'\' (seriative aspect) — \'\'we went out one at a time, one after another\'\'.\n\n====Conjugation====\n{{nv-paradigm |momentaneous |ni/ni|irr}} \n{{nv-verbtable|IMPERFECTIVE\n|chʼíníshááh|chʼíniidááh|chʼídaniidááh|chʼínínááh|chʼínóhhááh|chʼídanohhááh|chʼéghááh|chʼídaaghááh|chʼíjíghááh|chʼídajighááh}}\n{{nv-verbtable|PERFECTIVE\n|chʼíníyá|chʼíniidzá|chʼídaniidzá|chʼííníyá|chʼínooyá|chʼídanooyá|chʼíníyá||chʼízhníyá|}}\n{{nv-verbtable|FUTURE\n|chʼídeeshááł|chʼídiidááł|chʼídadiidááł|chʼídíínááł|chʼídoodááł|chʼídadoodááł|chʼídoogááł|chʼídadoogááł|chʼízhdoogááł|chʼídazhdoogááł}}==Navajo==\n\n===Etymology===\n{{nv-prefixes|di-legs|3s|d}} {{nv-link-to-stem|-dzééh}} {{nv-link-to-root|-DZAʼ|stagger}}.\n\nThe stem and root may actually be [[:Category:Navajo roots sharing the stem -zééh |\'\'-zééh\'\']] / {{m|nv|-ZAʼ}}.\n\n===Verb===\n{{head|nv|verb}}\n\n# he/she is [[stagger]]ing somewhere, [[stumble#Verb|stumbl]]ing somewhere\n\n====Usage notes====\nThis verb calls for an adverb or postpositional phrase describing the destination of the action.\n\n====Conjugation====\n{{nv-paradigm|momentaneous|Ø/yi|irr}} (shift to si-perfective in the duoplural et plural forms). \n{{nv-verbtable|IMPERFECTIVE\n|disdzééh|diidzééh|dadiidzééh|dídzééh|dohdzééh|dadohdzééh|didzééh|dadidzééh|jididzééh|dazhdidzééh}}\n{{nv-verbtable|PERFECTIVE\n|deesdzaʼ|deedzaʼ|dadeedzaʼ|díínídzaʼ|disoohdzaʼ|dadisoohdzaʼ|doodzaʼ|dadeesdzaʼ|jidoodzaʼ|dazhdeesdzaʼ}}==Navajo==\n\n===Etymology===\n{{nv-prefixes|di-oral|ni-adj|si|3s|ł}} {{nv-link-to-stem|-yéél |neuter perfective}} {{nv-link-to-root |-YÉÉL |calm|to be calm}}. \n\nThe root onset, originally *\'\'gh\'\' (> \'\'y\'\'), devoices after \'\' ł\'\'-classifier: \'\'ł\'\' + \'\'ghéél\'\' > \'\'ł\'\' + \'\'héél\'\'. \n\nFor the high tone on the prefix complex, see also {{m|nv |díní-}}. \n[[Category:Navajo verbs with prefix díní-]] \n\n===Verb===\n{{head|nv|verb}}\n\n# it/he/she is [[quiet]], [[noiseless]], [[still]], [[calm]]\n\n====Usage notes====\nThis is a neuter verb that uses only the perfective mode.\n\n====Conjugation====\n{{nv-paradigm|neuter perfective|si|irr}} (see also [[díní-#Conjugation|\'\'díní-\'\']]). \n{{nv-verbtable|PERFECTIVE\n|díníshhéél|díníilyéél|dadíníilyéél|díníłhéél|dínóołhéél|dadínóołhéél|déesxéél|dadéesxéél|jidéesxéél|dazdéesxéél}}\n\n====Related terms====\n* {{l|nv|diiłheeł}}\n* {{l|nv|hodéezyéél}}==Navajo==\n===Etymology===\n{{nv-prefixes|á-do|ná-rev|3o|3s|d}} {{nv-link-to-stem|-lééh}} {{nv-link-to-root|-LAA|make}}, ultimately from the root {{m|nv|-YAA}}.\n[[Category:Navajo terms belonging to the root -YAA (make)]]\n\n===Verb===\n{{head|nv|verb}}\n\n# he/she is [[repair]]ing it, [[fix]]ing it\n\n====Conjugation====\n{{nv-paradigm|momentaneous|Ø/yi|irr}} \n{{nv-verbtable|IMPERFECTIVE\n|ánáshdlééh|ánéiilnééh|ánádeiilnééh|ánánídlééh|ánáhdlééh|ánádaahdlééh|ánéídlééh|ánádeidlééh|áńjídlééh|ánádajidlééh}}\n{{nv-verbtable|PERFECTIVE\n|ánáshdlaa|ánéiilyaa|ánádeiilyaa|ánéinidlaa|ánáoodlaa|ánádaahdlaa|ánáyiidlaa|ánádayiidlaa|áńjiidlaa|ánádajiidlaa}}\n{{nv-verbtable|FUTURE\n|áńdeeshdlííł|áńdiilnííł|áńdadiilnííł|áńdíídlííł|áńdoohdlííł|áńdadoohdlííł|ánéidoodlííł|áńdeidoodlííł|ánízhdoodlííł|áńdazhdoodlííł}}==Navajo==\n\n===Etymology===\n{{nv-prefixes|á-comp|ní-comp|si|L}} {{nv-link-to-stem|zólí}} {{nv-link-to-root|-ZÓLĺ|light|to be light}}.\n\n===Verb===\n{{head|nv|verb}}\n\n# it is [[light]] (weighing little)\n\n====Usage notes====\nThis is a neuter verb. As such, it has only the imperfective stem.\nThird person is irregular and is reminiscent of a si-perfective.\n\n====Conjugation====\n{{nv-paradigm|neuter imperfective||irr}}\n{{nv-verbtable|IMPERFECTIVE\n|áníszólí|ániilzólí|ádaniilzólí|áníníłzólí|ánółzólí|ádanołzólí|ászólí|ádaaszólí|ájíszólí|ádajízólí}}\n\n====Derived terms====\n* {{l|nv|béésh ászólí}} (aluminum)\n* {{l|nv|níłchʼi ászólí}} (helium){{also|ili|iḻi|-ili|ili-}}\n==Navajo==\n\n===Etymology===\n{{m|nv|ʼa-||pos=thematic}} + {{m|nv|-ni-||pos=adjectival}} + {{m|nv|-Ø-||pos=3rd person subject prefix}} + {{m|nv|-Ø-||pos=classifier}} + {{m|nv|-LĮ́Į́ʼ|-lį́|pos=neuter verb stem|to be}}, from the root {{m|nv|-LĮ́Į́ʼ}}.\n[[Category:Navajo terms belonging to the root -LĮ́Į́ʼ (be)]]\n\n===Verb===\n{{head|nv|verb}}\n# he/she/it has a value, is worth\n#: {{m|nv|bą́ą́h ílį́}} - it is worth, it costs\n\n====Conjugation====\n<u>Paradigm:</u> Neuter ni-imperfective, with some irregularities.\n{{nv-verbtable|IMPERFECTIVE\n|anishłį́|?|?|aníłį́?|?|?|íłį́|?|?|?}}\n{| style="margin-bottom:.1em; margin-right:1em;width:22.5em; border:1px solid #AAAAAA; border-collapse:collapse;" cellpadding="4" rules="all"\n!bgcolor=#EFEAAA align=left style="font-size:90%;"|PERFECTIVE\n!bgcolor=#EFEFFF align=center WIDTH="166" style="font-size:90%;"|singular\n|-\n!bgcolor=#EFEFFF align=left style="font-size:90%;"|3rd person\n|align=center|{{l|nv|azlį́į́ʼ}}\n|}\n{| style="margin-bottom:1em; margin-right:1em;width:22.5em; border:1px solid #AAAAAA; border-collapse:collapse;" cellpadding="4" rules="all"\n!bgcolor=#EFEAAA align=left style="font-size:90%;"|FUTURE\n!bgcolor=#EFEFFF align=center WIDTH="166" style="font-size:90%;"|singular\n|-\n!bgcolor=#EFEFFF align=left style="font-size:90%;"|3rd person\n|align=center|{{l|nv|adooleeł}}\n|}\n\n====Related terms====\n* {{l|nv|ílį́įgo}}\n* {{l|nv|ílį́įnii}}\n\n[[Category:Navajo verbs neuter ni-imperfective]] \n[[Category:Navajo irregular verbs]]'