Rename file
This commit is contained in:
parent
79ad2f9653
commit
9bc5ac01bf
@ -2,12 +2,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from queue import Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from wcferry import Wcf
|
from wcferry import Wcf
|
||||||
|
|
||||||
logging.basicConfig(level='DEBUG', format="%(asctime)s %(message)s")
|
logging.basicConfig(level='DEBUG', format="%(asctime)s [%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
|
||||||
LOG = logging.getLogger("Demo")
|
LOG = logging.getLogger("Demo")
|
||||||
|
|
||||||
|
|
||||||
@ -16,15 +17,16 @@ def process_msg(wcf: Wcf):
|
|||||||
while wcf.is_receiving_msg():
|
while wcf.is_receiving_msg():
|
||||||
try:
|
try:
|
||||||
msg = wcf.get_msg()
|
msg = wcf.get_msg()
|
||||||
|
LOG.info(msg) # 简单打印
|
||||||
|
except Empty:
|
||||||
|
continue # Empty message
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
continue
|
LOG.error(f"Receiving message error: {e}")
|
||||||
|
|
||||||
LOG.info(msg) # 简单打印
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
LOG.info("Start demo...")
|
LOG.info("Start demo...")
|
||||||
wcf = Wcf(debug=True) # 默认连接本地服务
|
wcf = Wcf(host="192.168.1.104", debug=True) # 默认连接本地服务
|
||||||
|
|
||||||
sleep(5) # 等微信加载好,以免信息显示异常
|
sleep(5) # 等微信加载好,以免信息显示异常
|
||||||
LOG.info(f"已经登录: {True if wcf.is_login() else False}")
|
LOG.info(f"已经登录: {True if wcf.is_login() else False}")
|
||||||
@ -76,9 +78,11 @@ def main():
|
|||||||
wcf.refresh_pyq(0) # 刷新朋友圈第一页
|
wcf.refresh_pyq(0) # 刷新朋友圈第一页
|
||||||
# wcf.refresh_pyq(id) # 从 id 开始刷新朋友圈
|
# wcf.refresh_pyq(id) # 从 id 开始刷新朋友圈
|
||||||
|
|
||||||
# 一直运行
|
return wcf
|
||||||
wcf.keep_running()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
wcf = main()
|
||||||
|
|
||||||
|
# 一直运行
|
||||||
|
wcf.keep_running()
|
Loading…
Reference in New Issue
Block a user