# -*- coding: utf-8 -*-
import pwb
import pywikibot
site = pywikibot.Site("wikipedia", "wikipedia")
page = pywikibot.Page(site, u'发热')
item = pywikibot.ItemPage.fromPage(page)  # this can be used for any page object
item.get()  # you need to call it to access any data.
sitelinks = item.sitelinks
aliases = item.aliases
if 'zh' in item.labels:
    print('The label in English is: ' + item.labels['zh'])
---------------------------------------------------------------------------
UnknownSite                               Traceback (most recent call last)
<ipython-input-18-fc9323ee7220> in <module>()
      2 import pwb
      3 import pywikibot
----> 4 site = pywikibot.Site("wikipedia", "wikipedia")
      5 page = pywikibot.Page(site, u'发热')
      6 item = pywikibot.ItemPage.fromPage(page)  # this can be used for any page object

/srv/paws/pwb/pywikibot/__init__.py in Site(code, fam, user, sysop, interface, url)
    883     key = '%s:%s:%s:%s' % (interface.__name__, fam, code, user)
    884     if key not in _sites or not isinstance(_sites[key], interface):
--> 885         _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
    886         debug(u"Instantiated %s object '%s'"
    887               % (interface.__name__, _sites[key]), _logger)

/srv/paws/pwb/pywikibot/site.py in __init__(self, code, fam, user, sysop)
   1855     def __init__(self, code, fam=None, user=None, sysop=None):
   1856         """Constructor."""
-> 1857         BaseSite.__init__(self, code, fam, user, sysop)
   1858         self._msgcache = {}
   1859         self._loginstatus = LoginStatus.NOT_ATTEMPTED

/srv/paws/pwb/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 'wikipedia' does not exist in family wikipedia
import pwb
import pywikibot
site = pywikibot.Site('en', 'wikipedia')
page = pywikibot.Page(site, 'fever')
item = pywikibot.ItemPage.fromPage(page)  # this can be used for any page object
item.get()  # you need to call it to access any data.
sitelinks = item.sitelinks
aliases = item.aliases
if 'zh' in item.labels:
    print('The label in English is: ' + item.labels['zh'])
WARNING: API error mwoauth-invalid-authorization-invalid-user: The authorization headers in your request are for a user that does not exist here
---------------------------------------------------------------------------
NoUsername                                Traceback (most recent call last)
<ipython-input-22-bac914e0c129> in <module>()
      2 import pywikibot
      3 site = pywikibot.Site('en', 'wikipedia')
----> 4 page = pywikibot.Page(site, 'fever')
      5 item = pywikibot.ItemPage.fromPage(page)  # this can be used for any page object
      6 item.get()  # you need to call it to access any data.

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1446                              cls, depth)
   1447                     del __kw[old_arg]
-> 1448             return obj(*__args, **__kw)
   1449 
   1450         if not __debug__:

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
   2177                 raise ValueError(u'Title must be specified and not empty '
   2178                                  'if source is a Site.')
-> 2179         super(Page, self).__init__(source, title, ns)
   2180 
   2181     @deprecate_arg("get_redirect", None)

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
    161 
    162         if isinstance(source, pywikibot.site.BaseSite):
--> 163             self._link = Link(title, source=source, defaultNamespace=ns)
    164             self._revisions = {}
    165         elif isinstance(source, Page):

/srv/paws/pwb/pywikibot/page.py in __init__(self, text, source, defaultNamespace)
   5084         # See bug T104864, defaultNamespace might have been deleted.
   5085         try:
-> 5086             self._defaultns = self._source.namespaces[defaultNamespace]
   5087         except KeyError:
   5088             self._defaultns = defaultNamespace

/srv/paws/pwb/pywikibot/site.py in namespaces(self)
   1012         """Return dict of valid namespaces on this wiki."""
   1013         if not hasattr(self, '_namespaces'):
-> 1014             self._namespaces = NamespacesDict(self._build_namespaces())
   1015         return self._namespaces
   1016 

/srv/paws/pwb/pywikibot/site.py in _build_namespaces(self)
   2610         # For versions lower than 1.14, APISite needs to override
   2611         # the defaults defined in Namespace.
-> 2612         is_mw114 = MediaWikiVersion(self.version()) >= MediaWikiVersion('1.14')
   2613 
   2614         for nsdata in self.siteinfo.get('namespaces', cache=False).values():

/srv/paws/pwb/pywikibot/site.py in version(self)
   2723         if not version:
   2724             try:
-> 2725                 version = self.siteinfo.get('generator', expiry=1).split(' ')[1]
   2726             except pywikibot.data.api.APIError:
   2727                 # May occur if you are not logged in (no API read permissions).

/srv/paws/pwb/pywikibot/site.py in get(self, key, get_default, cache, expiry)
   1674                 elif not Siteinfo._is_expired(cached[1], expiry):
   1675                     return copy.deepcopy(cached[0])
-> 1676         preloaded = self._get_general(key, expiry)
   1677         if not preloaded:
   1678             preloaded = self._get_siteinfo(key, expiry)[key]

/srv/paws/pwb/pywikibot/site.py in _get_general(self, key, expiry)
   1620                         u"', '".join(props)), _logger)
   1621             props += ['general']
-> 1622             default_info = self._get_siteinfo(props, expiry)
   1623             for prop in props:
   1624                 self._cache[prop] = default_info[prop]

/srv/paws/pwb/pywikibot/site.py in _get_siteinfo(self, prop, expiry)
   1546             # warnings are handled later
   1547             request._warning_handler = warn_handler
-> 1548             data = request.submit()
   1549         except api.APIError as e:
   1550             if e.code == 'siunknown_siprop':

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   2340         cached_available = self._load_cache()
   2341         if not cached_available:
-> 2342             self._data = super(CachedRequest, self).submit()
   2343             self._write_cache(self._data)
   2344         else:

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   2173                     continue
   2174                 raise NoUsername('Failed OAuth authentication for %s: %s'
-> 2175                                  % (self.site, info))
   2176             # raise error
   2177             try:

NoUsername: Failed OAuth authentication for wikipedia:en: The authorization headers in your request are for a user that does not exist here