Simple Python Wrapper around MediaWiki API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
mwapi
.gitignore
.travis.yml
LICENSE
MANIFEST.in
README.md
demo_mwoauth.py
demo_queries.py
demo_timeout.py
demo_warning.py
setup.cfg
setup.py
tox.ini

README.md

MediaWiki API

This MIT Licensed library provides a very simple convenience wrapper around the MediaWiki API. and includes support for authenticated sessions. It requires Python 3 and that your wiki is using MediaWiki 1.15.3 or greater.

Example

>>> import mwapi
>>>
>>> session = mwapi.Session('https://en.wikipedia.org')
>>>
>>> print(session.get(action='query', meta='userinfo'))
{'query': {'userinfo': {'anon': '', 'name': '75.72.203.28', 'id': 0}},
 'batchcomplete': ''}
>>>
>>> print(session.get(action='query', prop='revisions', revids=32423425))
{'query': {'pages': {'1429626': {'ns': 0, 'revisions': [{'user':
 'Wknight94', 'parentid': 32276615, 'comment':
 '/* References */ Removing less-specific cat', 'revid': 32423425,
 'timestamp': '2005-12-23T00:07:17Z'}], 'title': 'Grigol Ordzhonikidze',
 'pageid': 1429626}}}, 'batchcomplete': ''}

Authors