/aiowiki

An asynchronous python libary to get mediawiki content

Primary LanguagePythonMIT LicenseMIT

aiowiki

An asynchronous python libary to get mediawiki content

Codacy Badge CodeFactor BCH compliance FOSSA Status Code style: black CircleCI License codecov Downloads on Pypi

Installation

It requires Python 3.6 or above and aiohttp

pip3 install git+https://github.com/Gelbpunkt/aiowiki

Quick start

import aiowiki

wiki = aiowiki.Wiki.wikipedia("en") # We're using the alternate constructor for pre-made Wikipedia Wikis
await wiki.login("test", "pass1234") # Logging in (optional)

pages = await wiki.get_random_pages(3) # get a list of random pages
pages = await wiki.opensearch("Monty Python") # gets page objects by search

page = wiki.get_page("aiowiki") # get a specific page

print(await page.html()) # print the pure page html
print(await page.markdown()) # print the pure page markdown (wiki code)
print(await page.text()) # print the page's text (library handles filtering of the HTML)

await page.edit("That's a nice lib!") # edit the page, automatically uses the logged in user or anonymous

await wiki.close() # the Wiki object also supports a context manager (async with) to close automatically

License

FOSSA Status