Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 2.48 KB

README.md

File metadata and controls

42 lines (30 loc) · 2.48 KB

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