Name | mwbot JSON |
Version |
1.0.38
JSON |
| download |
home_page | None |
Summary | 个性化封装的Python Mediawiki API库 |
upload_time | 2024-08-01 05:49:16 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4.0,>=3.9 |
license | MIT |
keywords |
mediawiki
api
bot
auto
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## mwbot(Python)
mwbot是一个基于Python的异步 Mediawiki API库,同时封装了用于[PRTS wiki](https://prts.wiki)的[部分方法](https://github.com/GuGuMur/mwbot/blob/main/mwbot/arktool.py)
## 快速使用
### 前备工作
#### 安装
pip install mwbot -i https://pypi.org/simple/
#### 获取Bot应有的参数
1. 前往对应wiki的 特殊:版本 页面获取wiki的index.php, api.php的路径
2. 前往对应wiki的 特殊:BotPasswords 创建一套机器人密码
<details><summary>详细过程</summary>
1. 填入“机器人名称”。(如:BotName)
2. 选择下方的权限
- 这将能够限制通过机器人密码登录后的账户权限,尤其是当你的人工账户和机器人是同一账户时,这将有效保护你的账户。
- bot只能使用您选中的与您拥有的权限的交集。
3. 创建成功,获得机器人密码,你将有两种登录机器人的方式,任意一种都能登录至机器人账户:
- 登录名为User@BotName,密码为BotPassword
- 登录名为User,密码为BotName@BotPassword
</details>
### 开始使用
```python
from mwbot import Bot
import asyncio
async def main():
bot = Bot(
sitename="my_wiki", # 替换为你所在的Wiki名,便于参考
api="api", # 替换为对应Wiki的api.php路径
index="index", #替换为对应Wiki的index.php路径
username="User",
password="BotName@BotPassword")
# 将username和password替换为你刚才获得的机器人登录名和密码
# 你只能选择一种登录方式,并填入对应登录方式的登录名和密码
await bot.login()
# 样例:打印页面 用户:User 的内容
r = await bot.get_page_text(title="用户:User")
print(r)
if __name__ == "__main__":
asyncio.run(main())
```
## 深入
* [示例](https://github.com/GuGuMur/mwbot/tree/main/examples)
* [文档](https://gugumur.github.io/mwbot)
Raw data
{
"_id": null,
"home_page": null,
"name": "mwbot",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "Mediawiki, API, bot, auto",
"author": null,
"author_email": "\u5495\u5495mur <2221533105@qq.com>",
"download_url": "https://files.pythonhosted.org/packages/5f/50/a7f8224718a727951a51c00568ac8d00d4f3179cc52eec8998e3e84a2d70/mwbot-1.0.38.tar.gz",
"platform": null,
"description": "## mwbot(Python)\nmwbot\u662f\u4e00\u4e2a\u57fa\u4e8ePython\u7684\u5f02\u6b65 Mediawiki API\u5e93\uff0c\u540c\u65f6\u5c01\u88c5\u4e86\u7528\u4e8e[PRTS wiki](https://prts.wiki)\u7684[\u90e8\u5206\u65b9\u6cd5](https://github.com/GuGuMur/mwbot/blob/main/mwbot/arktool.py)\n\n## \u5feb\u901f\u4f7f\u7528\n### \u524d\u5907\u5de5\u4f5c\n#### \u5b89\u88c5\n pip install mwbot -i https://pypi.org/simple/\n#### \u83b7\u53d6Bot\u5e94\u6709\u7684\u53c2\u6570\n1. \u524d\u5f80\u5bf9\u5e94wiki\u7684 \u7279\u6b8a:\u7248\u672c \u9875\u9762\u83b7\u53d6wiki\u7684index.php, api.php\u7684\u8def\u5f84\n2. \u524d\u5f80\u5bf9\u5e94wiki\u7684 \u7279\u6b8a:BotPasswords \u521b\u5efa\u4e00\u5957\u673a\u5668\u4eba\u5bc6\u7801\n\n<details><summary>\u8be6\u7ec6\u8fc7\u7a0b</summary>\n\n1. \u586b\u5165\u201c\u673a\u5668\u4eba\u540d\u79f0\u201d\u3002\uff08\u5982\uff1aBotName\uff09\n\n2. \u9009\u62e9\u4e0b\u65b9\u7684\u6743\u9650\n - \u8fd9\u5c06\u80fd\u591f\u9650\u5236\u901a\u8fc7\u673a\u5668\u4eba\u5bc6\u7801\u767b\u5f55\u540e\u7684\u8d26\u6237\u6743\u9650\uff0c\u5c24\u5176\u662f\u5f53\u4f60\u7684\u4eba\u5de5\u8d26\u6237\u548c\u673a\u5668\u4eba\u662f\u540c\u4e00\u8d26\u6237\u65f6\uff0c\u8fd9\u5c06\u6709\u6548\u4fdd\u62a4\u4f60\u7684\u8d26\u6237\u3002\n - bot\u53ea\u80fd\u4f7f\u7528\u60a8\u9009\u4e2d\u7684\u4e0e\u60a8\u62e5\u6709\u7684\u6743\u9650\u7684\u4ea4\u96c6\u3002\n \n3. \u521b\u5efa\u6210\u529f\uff0c\u83b7\u5f97\u673a\u5668\u4eba\u5bc6\u7801\uff0c\u4f60\u5c06\u6709\u4e24\u79cd\u767b\u5f55\u673a\u5668\u4eba\u7684\u65b9\u5f0f\uff0c\u4efb\u610f\u4e00\u79cd\u90fd\u80fd\u767b\u5f55\u81f3\u673a\u5668\u4eba\u8d26\u6237\uff1a\n - \u767b\u5f55\u540d\u4e3aUser@BotName\uff0c\u5bc6\u7801\u4e3aBotPassword\n - \u767b\u5f55\u540d\u4e3aUser\uff0c\u5bc6\u7801\u4e3aBotName@BotPassword\n</details>\n\n### \u5f00\u59cb\u4f7f\u7528\n```python\nfrom mwbot import Bot\nimport asyncio\nasync def main():\n bot = Bot(\n sitename=\"my_wiki\", # \u66ff\u6362\u4e3a\u4f60\u6240\u5728\u7684Wiki\u540d\uff0c\u4fbf\u4e8e\u53c2\u8003\n api=\"api\", # \u66ff\u6362\u4e3a\u5bf9\u5e94Wiki\u7684api.php\u8def\u5f84\n index=\"index\", #\u66ff\u6362\u4e3a\u5bf9\u5e94Wiki\u7684index.php\u8def\u5f84\n username=\"User\",\n password=\"BotName@BotPassword\")\n # \u5c06username\u548cpassword\u66ff\u6362\u4e3a\u4f60\u521a\u624d\u83b7\u5f97\u7684\u673a\u5668\u4eba\u767b\u5f55\u540d\u548c\u5bc6\u7801\n # \u4f60\u53ea\u80fd\u9009\u62e9\u4e00\u79cd\u767b\u5f55\u65b9\u5f0f\uff0c\u5e76\u586b\u5165\u5bf9\u5e94\u767b\u5f55\u65b9\u5f0f\u7684\u767b\u5f55\u540d\u548c\u5bc6\u7801\n await bot.login()\n \n # \u6837\u4f8b\uff1a\u6253\u5370\u9875\u9762 \u7528\u6237:User \u7684\u5185\u5bb9\n r = await bot.get_page_text(title=\"\u7528\u6237:User\")\n print(r)\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n## \u6df1\u5165\n* [\u793a\u4f8b](https://github.com/GuGuMur/mwbot/tree/main/examples)\n* [\u6587\u6863](https://gugumur.github.io/mwbot)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u4e2a\u6027\u5316\u5c01\u88c5\u7684Python Mediawiki API\u5e93",
"version": "1.0.38",
"project_urls": null,
"split_keywords": [
"mediawiki",
" api",
" bot",
" auto"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "32a69ba47474e9cd12b2cba3f60e608eb90a9de1dcaf03bf94da95298202f133",
"md5": "3ae180858236b91cc459ef503ac59eab",
"sha256": "9ace121afe211271d4d982b83d9be5c029077a36a2952fed7bb567e22eb43bc8"
},
"downloads": -1,
"filename": "mwbot-1.0.38-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3ae180858236b91cc459ef503ac59eab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 11536,
"upload_time": "2024-08-01T05:49:14",
"upload_time_iso_8601": "2024-08-01T05:49:14.895379Z",
"url": "https://files.pythonhosted.org/packages/32/a6/9ba47474e9cd12b2cba3f60e608eb90a9de1dcaf03bf94da95298202f133/mwbot-1.0.38-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5f50a7f8224718a727951a51c00568ac8d00d4f3179cc52eec8998e3e84a2d70",
"md5": "e8d900f5eb99087137705684cedcc9a7",
"sha256": "31350b7f33d7627bc965759c38cf0ee05256aec066ee8b52bc91fd97a53839ac"
},
"downloads": -1,
"filename": "mwbot-1.0.38.tar.gz",
"has_sig": false,
"md5_digest": "e8d900f5eb99087137705684cedcc9a7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 9753,
"upload_time": "2024-08-01T05:49:16",
"upload_time_iso_8601": "2024-08-01T05:49:16.447539Z",
"url": "https://files.pythonhosted.org/packages/5f/50/a7f8224718a727951a51c00568ac8d00d4f3179cc52eec8998e3e84a2d70/mwbot-1.0.38.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-01 05:49:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mwbot"
}