import pywikibot
site = pywikibot.Site('ta', 'wikiquote')
site
APISite("ta", "wikipedia")
page = pywikibot.Page(site, 'User:Maathavan/3')
page.exists()
True
page.text
'\n\nmaathavan test\n\nffdjsf'
page.text = 'Hello world'
page.save()

NoUsernameTraceback (most recent call last)
/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in _save(self, summary, watch, minor, botflag, async, callback, cc, quiet, **kwargs)
   1177             done = self.site.editpage(self, summary=summary, minor=minor,
-> 1178                                       watch=watch, bot=botflag, **kwargs)
   1179             if not done:

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in callee(self, *args, **kwargs)
   1299             if grp == 'user':
-> 1300                 self.login(False)
   1301             elif grp == 'sysop':

/srv/paws/lib/python3.4/site-packages/pywikibot/site.py in login(self, sysop)
   2051                                     'wrong': self.userinfo['name'],
-> 2052                                     'right': self._username[sysop]})
   2053             else:

NoUsername: Logged in on wikipedia:ta via OAuth as Maathavan, but expect as TamizhBOT

During handling of the above exception, another exception occurred:

OtherPageSaveErrorTraceback (most recent call last)
<ipython-input-4-fdf5b810a7b1> in <module>()
      1 page.text = 'Hello world'
----> 2 page.save()

/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 save(self, summary, watch, minor, botflag, force, async, callback, apply_cosmetic_changes, quiet, **kwargs)
   1165             self._save(summary=summary, watch=watch, minor=minor,
   1166                        botflag=botflag, async=async, callback=callback,
-> 1167                        cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
   1168 
   1169     def _save(self, summary=None, watch=None, minor=True, botflag=None,

/srv/paws/lib/python3.4/site-packages/pywikibot/page.py in _save(self, summary, watch, minor, botflag, async, callback, cc, quiet, **kwargs)
   1191                 if isinstance(err, pywikibot.PageSaveRelatedError):
   1192                     raise err
-> 1193                 raise pywikibot.OtherPageSaveError(self, err)
   1194         if callback:
   1195             callback(self, err)

OtherPageSaveError: Edit to page [[ta:பயனர்:Maathavan/3]] failed:
Logged in on wikipedia:ta via OAuth as Maathavan, but expect as TamizhBOT
import pywikibot

site = pywikibot.Site('ta', 'wikipedia')
page = pywikibot.Page(site, 'test')

page.text = 'Hello world!'
page.save()