调整代码
This commit is contained in:
@@ -44,4 +44,5 @@ pywin32==306
|
|||||||
|
|
||||||
gewechat-client==0.1.5
|
gewechat-client==0.1.5
|
||||||
fastapi~=0.115.12
|
fastapi~=0.115.12
|
||||||
uvicorn~=0.34.2
|
uvicorn~=0.34.2
|
||||||
|
dacite~=1.9.2
|
||||||
9
robot.py
9
robot.py
@@ -3,6 +3,8 @@ import logging
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import dacite
|
||||||
|
|
||||||
from base.func_epic import is_friday, get_free
|
from base.func_epic import is_friday, get_free
|
||||||
|
|
||||||
from base.func_news import News
|
from base.func_news import News
|
||||||
@@ -65,7 +67,12 @@ class Robot(Job):
|
|||||||
self.contact_manager.set_contacts(self.allContacts)
|
self.contact_manager.set_contacts(self.allContacts)
|
||||||
|
|
||||||
# 获取个人信息
|
# 获取个人信息
|
||||||
profile: Profile = self.client.get_profile(self.app_id)
|
profile_dict = self.client.get_profile(self.app_id)
|
||||||
|
try:
|
||||||
|
profile: Profile = dacite.from_dict(Profile, profile_dict)
|
||||||
|
except Exception as e:
|
||||||
|
self.LOG.info(f"Profile dict 转换失败: {e}")
|
||||||
|
return
|
||||||
if profile.data.wxid is None:
|
if profile.data.wxid is None:
|
||||||
self.LOG.info(f"获取个人信息失败,退出程序!")
|
self.LOG.info(f"获取个人信息失败,退出程序!")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user