import pywikibot
site = pywikibot.Site()
page = pywikibot.Page(site, u"Wikipedia:Bots")
WARNING: API error mwoauth-invalid-authorization-invalid-user: The authorization headers in your request are for a user that does not exist here

NoUsernameTraceback (most recent call last)
<ipython-input-5-8fdd3902da08> in <module>()
----> 1 page = pywikibot.Page(site, u"Wikipedia:Bots")

/srv/paws/lib/python3.4/site-packages/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1412                              cls, depth)
   1413                     del __kw[old_arg]
-> 1414             return obj(*__args, **__kw)
   1415 
   1416         if not __debug__:

/srv/paws/lib/python3.4/site-packages/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1412                              cls, depth)
   1413                     del __kw[old_arg]
-> 1414             return obj(*__args, **__kw)
   1415 
   1416         if not __debug__:

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, source, title, ns)
   2118                 raise ValueError(u'Title must be specified and not empty '
   2119                                  'if source is a Site.')
-> 2120         super(Page, self).__init__(source, title, ns)
   2121 
   2122     @deprecate_arg("get_redirect", None)

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, source, title, ns)
    132 
    133         if isinstance(source, pywikibot.site.BaseSite):
--> 134             self._link = Link(title, source=source, defaultNamespace=ns)
    135             self._revisions = {}
    136         elif isinstance(source, Page):

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, text, source, defaultNamespace)
   4877         # See bug T104864, defaultNamespace might have been deleted.
   4878         try:
-> 4879             self._defaultns = self._source.namespaces[defaultNamespace]
   4880         except KeyError:
   4881             self._defaultns = defaultNamespace

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in namespaces(self)
   1007         """Return dict of valid namespaces on this wiki."""
   1008         if not hasattr(self, '_namespaces'):
-> 1009             self._namespaces = NamespacesDict(self._build_namespaces())
   1010         return self._namespaces
   1011 

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in _build_namespaces(self)
   2577         # For versions lower than 1.14, APISite needs to override
   2578         # the defaults defined in Namespace.
-> 2579         is_mw114 = MediaWikiVersion(self.version()) >= MediaWikiVersion('1.14')
   2580 
   2581         for nsdata in self.siteinfo.get('namespaces', cache=False).values():

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in version(self)
   2684         if not version:
   2685             try:
-> 2686                 version = self.siteinfo.get('generator', expiry=1).split(' ')[1]
   2687             except pywikibot.data.api.APIError:
   2688                 # May occur if you are not logged in (no API read permissions).

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in get(self, key, get_default, cache, expiry)
   1649                 elif not Siteinfo._is_expired(cached[1], expiry):
   1650                     return copy.deepcopy(cached[0])
-> 1651         preloaded = self._get_general(key, expiry)
   1652         if not preloaded:
   1653             preloaded = self._get_siteinfo(key, expiry)[key]

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in _get_general(self, key, expiry)
   1595                         u"', '".join(props)), _logger)
   1596             props += ['general']
-> 1597             default_info = self._get_siteinfo(props, expiry)
   1598             for prop in props:
   1599                 self._cache[prop] = default_info[prop]

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in _get_siteinfo(self, prop, expiry)
   1521             # warnings are handled later
   1522             request._warning_handler = warn_handler
-> 1523             data = request.submit()
   1524         except api.APIError as e:
   1525             if e.code == 'siunknown_siprop':

/srv/paws/lib/python3.4/site-packages/pywikibot/data/api.py in submit(self)
   2334         cached_available = self._load_cache()
   2335         if not cached_available:
-> 2336             self._data = super(CachedRequest, self).submit()
   2337             self._write_cache(self._data)
   2338         else:

/srv/paws/lib/python3.4/site-packages/pywikibot/data/api.py in submit(self)
   2167             if 'mwoauth-invalid-authorization' in code:
   2168                 raise NoUsername('Failed OAuth authentication for %s: %s'
-> 2169                                  % (self.site, info))
   2170             # raise error
   2171             try:

NoUsername: Failed OAuth authentication for wikipedia:ta: The authorization headers in your request are for a user that does not exist here
from pywikibot import pagegenerators
site = pywikibot.Site()
cat = pywikibot.Category(site,'Category:Living people')
WARNING: API error mwoauth-invalid-authorization-invalid-user: The authorization headers in your request are for a user that does not exist here

NoUsernameTraceback (most recent call last)
<ipython-input-10-fbf34c86742d> in <module>()
----> 1 cat = pywikibot.Category(site,'Category:Living people')

/srv/paws/lib/python3.4/site-packages/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1412                              cls, depth)
   1413                     del __kw[old_arg]
-> 1414             return obj(*__args, **__kw)
   1415 
   1416         if not __debug__:

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, source, title, sortKey)
   2428         """
   2429         self.sortKey = sortKey
-> 2430         Page.__init__(self, source, title, ns=14)
   2431         if self.namespace() != 14:
   2432             raise ValueError(u"'%s' is not in the category namespace!"

/srv/paws/lib/python3.4/site-packages/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1412                              cls, depth)
   1413                     del __kw[old_arg]
-> 1414             return obj(*__args, **__kw)
   1415 
   1416         if not __debug__:

/srv/paws/lib/python3.4/site-packages/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1412                              cls, depth)
   1413                     del __kw[old_arg]
-> 1414             return obj(*__args, **__kw)
   1415 
   1416         if not __debug__:

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, source, title, ns)
   2118                 raise ValueError(u'Title must be specified and not empty '
   2119                                  'if source is a Site.')
-> 2120         super(Page, self).__init__(source, title, ns)
   2121 
   2122     @deprecate_arg("get_redirect", None)

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, source, title, ns)
    132 
    133         if isinstance(source, pywikibot.site.BaseSite):
--> 134             self._link = Link(title, source=source, defaultNamespace=ns)
    135             self._revisions = {}
    136         elif isinstance(source, Page):

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in __init__(self, text, source, defaultNamespace)
   4877         # See bug T104864, defaultNamespace might have been deleted.
   4878         try:
-> 4879             self._defaultns = self._source.namespaces[defaultNamespace]
   4880         except KeyError:
   4881             self._defaultns = defaultNamespace

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in namespaces(self)
   1007         """Return dict of valid namespaces on this wiki."""
   1008         if not hasattr(self, '_namespaces'):
-> 1009             self._namespaces = NamespacesDict(self._build_namespaces())
   1010         return self._namespaces
   1011 

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in _build_namespaces(self)
   2577         # For versions lower than 1.14, APISite needs to override
   2578         # the defaults defined in Namespace.
-> 2579         is_mw114 = MediaWikiVersion(self.version()) >= MediaWikiVersion('1.14')
   2580 
   2581         for nsdata in self.siteinfo.get('namespaces', cache=False).values():

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in version(self)
   2684         if not version:
   2685             try:
-> 2686                 version = self.siteinfo.get('generator', expiry=1).split(' ')[1]
   2687             except pywikibot.data.api.APIError:
   2688                 # May occur if you are not logged in (no API read permissions).

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in get(self, key, get_default, cache, expiry)
   1649                 elif not Siteinfo._is_expired(cached[1], expiry):
   1650                     return copy.deepcopy(cached[0])
-> 1651         preloaded = self._get_general(key, expiry)
   1652         if not preloaded:
   1653             preloaded = self._get_siteinfo(key, expiry)[key]

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in _get_general(self, key, expiry)
   1595                         u"', '".join(props)), _logger)
   1596             props += ['general']
-> 1597             default_info = self._get_siteinfo(props, expiry)
   1598             for prop in props:
   1599                 self._cache[prop] = default_info[prop]

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in _get_siteinfo(self, prop, expiry)
   1521             # warnings are handled later
   1522             request._warning_handler = warn_handler
-> 1523             data = request.submit()
   1524         except api.APIError as e:
   1525             if e.code == 'siunknown_siprop':

/srv/paws/lib/python3.4/site-packages/pywikibot/data/api.py in submit(self)
   2334         cached_available = self._load_cache()
   2335         if not cached_available:
-> 2336             self._data = super(CachedRequest, self).submit()
   2337             self._write_cache(self._data)
   2338         else:

/srv/paws/lib/python3.4/site-packages/pywikibot/data/api.py in submit(self)
   2167             if 'mwoauth-invalid-authorization' in code:
   2168                 raise NoUsername('Failed OAuth authentication for %s: %s'
-> 2169                                  % (self.site, info))
   2170             # raise error
   2171             try:

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