MediaWiki API的简单包装
python-mwapi的Python项目详细描述
一个非常简单和直接的mediawiki api包装器
简介
这个库为Mediawiki API提供了一个非常简单的方便包装。它是为了紧密地镜像由mw.Api
提供的接口。功能
该库允许您调用mediawikiapi,而无需处理网络调用。它还具有身份验证支持和一些方便的方法。
非功能
这是反mwclient。它不会添加另一层供您在井documentedmediawiki api上理解,而且它永远不会:)
文档
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.
联系人
支持请求和火焰可以通过多种方式发送给我。
电子邮件:yuvipanda@gmail.com。推特:@yuvipanda.IRC:Freenode上的yuvipanda
你可以归档错误on Github。