import pywikibot

site = pywikibot.Site("test", "wikidata")
page = pywikibot.Page(site, u"Q4115189")
text = page.text
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-7-d1836eba7069> in <module>()
      2 
      3 site = pywikibot.Site("test", "wikidata")
----> 4 page = pywikibot.Page(site, u"Q4115189")
      5 text = page.text

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1518                              cls, depth)
   1519                     del __kw[old_arg]
-> 1520             return obj(*__args, **__kw)
   1521 
   1522         if not __debug__:

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
   2238                 raise ValueError(u'Title must be specified and not empty '
   2239                                  'if source is a Site.')
-> 2240         super(Page, self).__init__(source, title, ns)
   2241 
   2242     @property

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
    199 
    200         if isinstance(source, pywikibot.site.BaseSite):
--> 201             self._link = Link(title, source=source, defaultNamespace=ns)
    202             self._revisions = {}
    203         elif isinstance(source, Page):

/srv/paws/pwb/pywikibot/page.py in __init__(self, text, source, defaultNamespace)
   5363         # See bug T104864, defaultNamespace might have been deleted.
   5364         try:
-> 5365             self._defaultns = self._source.namespaces[defaultNamespace]
   5366         except KeyError:
   5367             self._defaultns = defaultNamespace

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

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

/srv/paws/pwb/pywikibot/site.py in version(self)
   2737             try:
   2738                 version = self.siteinfo.get('generator',
-> 2739                                             expiry=1).split(' ')[1]
   2740             except pywikibot.data.api.APIError:
   2741                 # 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)
   1657                 elif not Siteinfo._is_expired(cached[1], expiry):
   1658                     return copy.deepcopy(cached[0])
-> 1659         preloaded = self._get_general(key, expiry)
   1660         if not preloaded:
   1661             preloaded = self._get_siteinfo(key, expiry)[key]

/srv/paws/pwb/pywikibot/site.py in _get_general(self, key, expiry)
   1603                     .format("', '".join(props)), _logger)
   1604             props += ['general']
-> 1605             default_info = self._get_siteinfo(props, expiry)
   1606             for prop in props:
   1607                 self._cache[prop] = default_info[prop]

/srv/paws/pwb/pywikibot/site.py in _get_siteinfo(self, prop, expiry)
   1528             # warnings are handled later
   1529             request._warning_handler = warn_handler
-> 1530             data = request.submit()
   1531         except api.APIError as e:
   1532             if e.code == 'siunknown_siprop':

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   2347         cached_available = self._load_cache()
   2348         if not cached_available:
-> 2349             self._data = super(CachedRequest, self).submit()
   2350             self._write_cache(self._data)
   2351         else:

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   2176                     continue
   2177                 raise NoUsername('Failed OAuth authentication for %s: %s'
-> 2178                                  % (self.site, info))
   2179             if code == 'cirrussearch-too-busy-error':  # T170647
   2180                 self.wait()

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