Simple wrapper for the Mediawiki API
Project description
A very simple and direct wrapper around the Mediawiki API
Introduction
This library provides a very simple convenience wrapper around the Mediawiki API. It is meant to closely mirror the interface provided by mw.Api
Features
The library allows you to call Mediawiki APIs without having to deal without dealing with network calls. It also has authentication support and a few convenience methods.
Non Features
This is the anti-mwclient. It does not add another layer for you to understand over the well documented Mediawiki API, and it never will :)
Documentation
MWApi
- class MWApi
Class representing a single API Session, with a single authenticated user.Useful Attributes:tokens - Contains an edittoken & watchtoken (if populateTokens() has been called)is_authenticated - Boolean indicating if the MWApi is sending authenticated requestsMethods defined here:__init__(self, host, api_path=’/w/api.php’)Create a MWApi instanceArguments:api_path - Url to api.php on the host. Must start with /get(self, params)Makes an API request with the GET methodArguments:params - Parameters to send to the API. Varies depending on the action to be performed.login(self, username, password)Authenticates with the given credentials and logs in the user for the session.All further requests sent from this MWApi object will be signed as said user.Arguments:username - The username of the user to be authenticatedpassword - The password of the user to be authenticatedThrows:Throws an exception with (Message, Response) if Authentication failsNote:Passwords are sent as plaintext. This is a limitation of the Mediawiki API.Use a https host if you want your password to be securepopulateTokens(self)Populates the tokens attribute of the object with edittoken and watchtoken.Requires that authentication has been performed already with login()post(self, params)Makes an API request with the POST methodArguments:params - Parameters to send to the API. Varies depending on the action to be performed.request(self, method, params)Makes a request to the API and returns a dictionary containing the resultsArguments:method - GET or POST, depending on which API is being calledparams - Parameters to send to the API. Varies depending on the action to be performed.
Contact
Support requests and flames can be sent to me via several means.
Email: yuvipanda@gmail.com. Twitter: @yuvipanda. IRC: yuvipanda on FreeNode
You can file bugs on Github.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file python-mwapi-0.2.tar.gz
.
File metadata
- Download URL: python-mwapi-0.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4655aad95430b54c22a3219716813130e01740eb4454df0851d6c4040a7acf46 |
|
MD5 | e5bd81b38c974efcb4f2b05a100430bf |
|
BLAKE2b-256 | 4655fe6245d77fb2dba4db3c3b6c57ffd35a63edef4b928fdf2ddd163c72e30b |