Skip to content

Commit 5ba6428

Browse files
committed
Remove the default value for the argument save_path of Robot
1 parent 52059c1 commit 5ba6428

File tree

3 files changed

+43
-48
lines changed

3 files changed

+43
-48
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include README.md LICENSE
1+
include README.rst LICENSE

wxpy/__init__.py

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,57 @@
44
"""
55
66
wxpy
7-
~~~~
8-
微信个人号 API,基于 itchat,告别满屏 dict,更有 Python 范儿
7+
========
98
9+
微信个人号 API,基于 itchat,全面优化接口,更有 Python 范儿
1010
11-
## 代码示例
1211
13-
>>> # 导入所需的组件,也可直接 from wxpy import *
14-
>>> from wxpy import Robot, Friend, Group, MALE, TEXT
15-
>>>
16-
>>> # 初始化机器人,并登陆
17-
>>> robot = Robot()
18-
>>>
19-
>>> # 搜索名称含有 "游否" 的男性深圳好友
20-
>>> my_friend = robot.friends().search('游否', sex=MALE, city="深圳")[0]
21-
>>>
22-
>>> # 打印其他好友或群聊的文本消息 (装饰器语法,放在函数 def 的前一行即可)
23-
>>> @robot.register([Friend, Group], TEXT)
24-
>>> def reply_others(msg):
25-
>>> print(msg)
26-
>>>
27-
>>> # 回复 my_friend 的所有消息 (后注册的匹配优先级更高)
28-
>>> @robot.register(my_friend)
29-
>>> def reply_my_friend(msg):
30-
>>> return 'received: {} ({})'.format(msg.text, msg.type)
31-
>>>
32-
>>> # 开始监听和处理消息
33-
>>> robot.start()
12+
用 Python 玩转微信
13+
---------------------
3414
15+
登陆微信::
3516
36-
----
17+
# 导入机器人组件
18+
from wxpy import *
19+
# 初始化机器人,扫码登陆
20+
robot = Robot()
3721
38-
GitHub: https://github.com/youfou/wxpy
22+
简单发送消息::
3923
40-
----
24+
# 给自己的 "文件传输助手" 发送消息
25+
robot.file_helper.send('Hello WeChat!')
26+
# 发送图片
27+
robot.file_helper.send_image('my_picture.jpg')
4128
42-
:copyright: (c) 2017 by Youfou.
43-
:license: Apache 2.0, see LICENSE for more details.
29+
在微信中搜索::
4430
45-
"""
31+
# 搜索名称含有 "游否" 的男性深圳好友
32+
my_friend = robot.friends().search('游否', sex=MALE, city="深圳")[0]
33+
34+
自动响应各类消息::
35+
36+
# 打印来自好友或群聊的文本消息
37+
@robot.register([Friend, Group], TEXT)
38+
def reply_others(msg):
39+
print(msg)
4640
41+
# 回复 my_friend 的所有消息 (优先匹配后注册的函数!)
42+
@robot.register(my_friend)
43+
def reply_my_friend(msg):
44+
return 'received: {} ({})'.format(msg.text, msg.type)
4745
48-
# 机器人
49-
from .wx import Robot
50-
# 聊天对象类
51-
from .wx import Chat, Chats, Friend, Group, Groups, MP, Member, User
52-
# 性别
53-
from .wx import FEMALE, MALE
54-
# 消息类型
55-
from .wx import ATTACHMENT, CARD, FRIENDS, MAP, NOTE, PICTURE, RECORDING, SHARING, SYSTEM, TEXT, VIDEO
56-
# 实用工具
57-
from .utils import dont_raise_response_error, mutual_friends, ensure_one
58-
# 图灵机器人
59-
from .utils import Tuling
46+
# 开始监听和处理消息
47+
robot.start()
48+
49+
50+
"""
6051

52+
from .utils import Tuling, dont_raise_response_error, ensure_one, mutual_friends
53+
from .wx import ATTACHMENT, CARD, FEMALE, FRIENDS, MALE, MAP, NOTE, PICTURE, RECORDING, SHARING, SYSTEM, TEXT, VIDEO
54+
from .wx import Chat, Chats, Friend, Group, Groups, MP, Member, Message, Robot, User
6155

6256
__title__ = 'wxpy'
6357
__version__ = '0.0.6'
6458
__author__ = 'Youfou'
65-
__license__ = 'Apache 2.0'
59+
__license__ = 'MIT'
6660
__copyright__ = 'Copyright 2017 Youfou'

wxpy/wx.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,14 +981,15 @@ class Robot(object):
981981
"""
982982

983983
def __init__(
984-
self, save_path='wxpy.pkl',
985-
console_qr=False, qr_path=None, qr_callback=None,
986-
login_callback=None, logout_callback=None
984+
self, save_path=None, console_qr=False, qr_path=None,
985+
qr_callback=None, login_callback=None, logout_callback=None
987986
):
988987
"""
989988
初始化微信机器人
990989
991-
:param save_path: 用于保存/载入的登陆状态文件路径,可在短时间内重新载入登陆状态,失效时会重新要求登陆,若为空则不尝试载入
990+
:param save_path:
991+
用于保存或载入登陆状态的文件路径,例如: 'wxpy.pkl',为空则不尝试载入
992+
填写本参数后,可在短时间内重新载入登陆状态,避免重复扫码,失效时会重新要求登陆
992993
:param console_qr: 在终端中显示登陆二维码,需要安装 Pillow 模块
993994
:param qr_path: 保存二维码的路径
994995
:param qr_callback: 获得二维码时的回调,接收参数: uuid, status, qrcode

0 commit comments

Comments
 (0)