aiowiki package¶
Submodules¶
aiowiki.exceptions module¶
-
exception
aiowiki.exceptions.PageNotFound[source]¶ Bases:
ExceptionException raised when a page does not exist
-
exception
aiowiki.exceptions.LoginFailure[source]¶ Bases:
ExceptionException raised when a
login()fails
-
exception
aiowiki.exceptions.BadWikiUrl[source]¶ Bases:
ExceptionException raised when the URL of the
Wiki()is not in the standard Wikimedia API format
-
exception
aiowiki.exceptions.TokenGetError[source]¶ Bases:
ExceptionException raised when the internal acquiring for a token fails
-
exception
aiowiki.exceptions.CreateAccountError[source]¶ Bases:
ExceptionException raised when
create_account()fails
-
exception
aiowiki.exceptions.NoSuchUserError[source]¶ Bases:
ExceptionException raised when
userrights()fails because the target user does not exist
aiowiki.http module¶
-
class
aiowiki.http.HTTPClient(url, session, logged_in)[source]¶ Bases:
objectA Proxy object for all API actions
-
coroutine
opensearch(title, limit, namespace)[source]¶ Searches for a page title and returns limit results as a list
-
coroutine
aiowiki.page module¶
-
class
aiowiki.page.Page(page_title, wiki)[source]¶ Bases:
objectRepresents a Page in the
Wiki(). This is usually acquired byget_page()or other methods, and not created directly.- Parameters
page_title (str) – The title of the page.
wiki (
Wiki) – TheWiki()object this page belongs to.
- Variables
title – The page title
wiki – The
Wiki()it belongs to
aiowiki.wiki module¶
-
class
aiowiki.wiki.Wiki(base_url: str, session: Optional[aiohttp.client.ClientSession] = None)[source]¶ Bases:
objectRepresents a Mediawiki and is the main entry class to the library.
- Parameters
base_url (str) – The api.php endpoint of your Wiki
session (aiohttp.ClientSession or None) – An opional
aiohttp.ClientSessionto use for the internal Wiki HTTP operations. Leaving this empty will automatically create one.
- Variables
http – A
HTTPClient()for the Wikiurl – The API Url for the Wiki
-
coroutine
get_random_pages(num: int = 1, namespace: str = '*')[source]¶ Gets a list of random Page objects
-
coroutine
create_account(username: str, password: str, email: Optional[str] = None, real_name: Optional[str] = None)[source]¶ Creates an account in the wiki. May fail if captchas are required.