Skip to content

Instantly share code, notes, and snippets.

@olleolleolle
Created February 9, 2009 15:11
Show Gist options
  • Save olleolleolle/60818 to your computer and use it in GitHub Desktop.
Save olleolleolle/60818 to your computer and use it in GitHub Desktop.
Here is a sample usage of the mwclient API (MediaWiki used with Python)
import mwclient
username = u'WikiSysop'
password = u's3cr3t'
#site = mwclient.Site(('https', host), path = '/mediawiki-1.14.0rc1/')
host = u'tools'
site = mwclient.Site(host, path=u'/mediawiki-1.14.0rc1/')
site.login(username, password)
# Edit page
appname = u"Spencer Johnson and Co."
pagename = u'Automatic Export of %s' % (appname)
page = site.Pages[pagename]
text = page.edit()
print 'Text in sandbox:', text.encode('utf-8')
page.save(text + u'\nGetting more and better complex.', summary = 'Auto-export.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment