Code snippets in Python demonstrating how to use various modules of the MediaWiki Action API
- API:Tokens
- tokens.py: get tokens for data modifying operations
- API:Login
- login.py & clientlogin.py: login
- API:Parse
- parse.py: parse content of a page
- parse_wikitable.py: parse a section of its page and fetch its table data
- API:Categorymembers
- get_category_items.py: list twenty items in a category
- get_recent_category_items.py: get the ten articles most recently added to a category
- get_subcategories.py: get ten subcategories of a category
- API:Images
- get_page_images.py: get page images embedded on a page
- API:Purge
- purge_two_pages.py: purge cache of two or more pages
- purge_namespace_pages.py: purge cache of the first 10 pages in the main namespace
- API:Search
- search.py: search for a title or a text
- API:Geosearch
- geosearch.py: search for pages nearby
- geoimagesearch.py: search for pages nearby with images
- geocoordinates.py: obtain coordinates for wiki pages nearby
- API:Opensearch
- opensearch.py: fetch results in an opensearch format
- API:Prefixsearch
- prefixsearch.py: perform a prefix search for page titles
- API:Languagesearch
- languagesearch.py: search for a language
- Article suggestion: A sample app that uses MediaWiki Action API:Search allows you to pick a category and suggest articles to write on that don't yet exist on English Wikipedia. This app uses Flask and WTForms for rendering form.
$ git clone https://github.com/srish/MediaWiki_Action_API_Code_Samples
$ cd MediaWiki_Action_API_Code_Samples
Install the necessary python modules with pip
$ python3 name_of_the_file.py #Enter any credentials if required in the file