import pywikibot
site = pywikibot.Site("en", "wikipedia")
page = pywikibot.Page(site, "Douglas Adams")
item = pywikibot.ItemPage.fromPage(page)
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-2-e6dd9366b656> in <module>()
      1 site = pywikibot.Site("en", "wikipedia")
----> 2 page = pywikibot.Page(site, "Douglas Adams")
      3 item = pywikibot.ItemPage.fromPage(page)

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

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
   2257                 raise ValueError(u'Title must be specified and not empty '
   2258                                  'if source is a Site.')
-> 2259         super(Page, self).__init__(source, title, ns)
   2260 
   2261     @property

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
    190 
    191         if isinstance(source, pywikibot.site.BaseSite):
--> 192             self._link = Link(title, source=source, defaultNamespace=ns)
    193             self._revisions = {}
    194         elif isinstance(source, Page):

/srv/paws/pwb/pywikibot/page.py in __init__(self, text, source, defaultNamespace)
   5469         # See bug T104864, defaultNamespace might have been deleted.
   5470         try:
-> 5471             self._defaultns = self._source.namespaces[defaultNamespace]
   5472         except KeyError:
   5473             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)
   2621         # For versions lower than 1.14, APISite needs to override
   2622         # the defaults defined in Namespace.
-> 2623         is_mw114 = MediaWikiVersion(self.version()) >= MediaWikiVersion('1.14')
   2624 
   2625         for nsdata in self.siteinfo.get('namespaces', cache=False).values():

/srv/paws/pwb/pywikibot/site.py in version(self)
   2735             try:
   2736                 version = self.siteinfo.get('generator',
-> 2737                                             expiry=1).split(' ')[1]
   2738             except pywikibot.data.api.APIError:
   2739                 # 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)
   2367         cached_available = self._load_cache()
   2368         if not cached_available:
-> 2369             self._data = super(CachedRequest, self).submit()
   2370             self._write_cache(self._data)
   2371         else:

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

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