#!/usr/bin/python3
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-ef2f182b1788> in <module>()
      3 
      4 site = pywikibot.Site("en", "wikipedia")
----> 5 page = pywikibot.Page(site, "Douglas Adams")
      6 item = pywikibot.ItemPage.fromPage(page)
      7 

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1736                              cls, depth)
   1737                     del __kw[old_arg]
-> 1738             return obj(*__args, **__kw)
   1739 
   1740         if not __debug__:

/srv/paws/pwb/pywikibot/page.py in __init__(self, source, title, ns)
   2299                 raise ValueError('Title must be specified and not empty '
   2300                                  'if source is a Site.')
-> 2301         super(Page, self).__init__(source, title, ns)
   2302 
   2303     @property

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

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1736                              cls, depth)
   1737                     del __kw[old_arg]
-> 1738             return obj(*__args, **__kw)
   1739 
   1740         if not __debug__:

/srv/paws/pwb/pywikibot/page.py in __init__(self, text, source, default_namespace)
   5605         # See bug T104864, default_namespace might have been deleted.
   5606         try:
-> 5607             self._defaultns = self._source.namespaces[default_namespace]
   5608         except KeyError:
   5609             self._defaultns = default_namespace

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

/srv/paws/pwb/pywikibot/site.py in _build_namespaces(self)
   2642         _namespaces = {}
   2643 
-> 2644         for nsdata in self.siteinfo.get('namespaces', cache=False).values():
   2645             ns = nsdata.pop('id')
   2646             custom_name = None

/srv/paws/pwb/pywikibot/site.py in get(self, key, get_default, cache, expiry)
   1668                 elif not Siteinfo._is_expired(cached[1], expiry):
   1669                     return copy.deepcopy(cached[0])
-> 1670         preloaded = self._get_general(key, expiry)
   1671         if not preloaded:
   1672             preloaded = self._get_siteinfo(key, expiry)[key]

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

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

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   2232         cached_available = self._load_cache()
   2233         if not cached_available:
-> 2234             self._data = super(CachedRequest, self).submit()
   2235             self._write_cache(self._data)
   2236         else:

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

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