import pywikibot

site = pywikibot.Site("en", "wikipedia")
page = pywikibot.Page(site, "Douglas Adams")
item = pywikibot.ItemPage.fromPage(page)

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

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1744                              cls, depth)
   1745                     del __kw[old_arg]
-> 1746             return obj(*__args, **__kw)
   1747 
   1748         if not __debug__:

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
   2263                 raise ValueError(u'Title must be specified and not empty '
   2264                                  'if source is a Site.')
-> 2265         super(Page, self).__init__(source, title, ns)
   2266 
   2267     @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, default_namespace=ns)
    193             self._revisions = {}
    194         elif isinstance(source, Page):

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1744                              cls, depth)
   1745                     del __kw[old_arg]
-> 1746             return obj(*__args, **__kw)
   1747 
   1748         if not __debug__:

/srv/paws/pwb/pywikibot/page.py in __init__(self, text, source, default_namespace)
   5484         # See bug T104864, default_namespace might have been deleted.
   5485         try:
-> 5486             self._defaultns = self._source.namespaces[default_namespace]
   5487         except KeyError:
   5488             self._defaultns = default_namespace

/srv/paws/pwb/pywikibot/site.py in namespaces(self)
   1020         """Return dict of valid namespaces on this wiki."""
   1021         if not hasattr(self, '_namespaces'):
-> 1022             self._namespaces = NamespacesDict(self._build_namespaces())
   1023         return self._namespaces
   1024 

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

/srv/paws/pwb/pywikibot/site.py in version(self)
   2749             try:
   2750                 version = self.siteinfo.get('generator',
-> 2751                                             expiry=1).split(' ')[1]
   2752             except pywikibot.data.api.APIError:
   2753                 # 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)
   1669                 elif not Siteinfo._is_expired(cached[1], expiry):
   1670                     return copy.deepcopy(cached[0])
-> 1671         preloaded = self._get_general(key, expiry)
   1672         if not preloaded:
   1673             preloaded = self._get_siteinfo(key, expiry)[key]

/srv/paws/pwb/pywikibot/site.py in _get_general(self, key, expiry)
   1615                     .format("', '".join(props)), _logger)
   1616             props += ['general']
-> 1617             default_info = self._get_siteinfo(props, expiry)
   1618             for prop in props:
   1619                 self._cache[prop] = default_info[prop]

/srv/paws/pwb/pywikibot/site.py in _get_siteinfo(self, prop, expiry)
   1538         request._warning_handler = warn_handler
   1539         try:
-> 1540             data = request.submit()
   1541         except api.APIError as e:
   1542             if e.code == 'siunknown_siprop':

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   2428         cached_available = self._load_cache()
   2429         if not cached_available:
-> 2430             self._data = super(CachedRequest, self).submit()
   2431             self._write_cache(self._data)
   2432         else:

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

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