zycn0910 / Sign-ZXJY

职校家园(实习备案)打卡-2024.9.1可用
GNU General Public License v3.0
47 stars 24 forks source link

【已解决】报错 'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256) #37

Closed zkeq closed 7 months ago

zkeq commented 7 months ago

系统平台(Windows、Linux、云函数):Linux

config.py内开启了什么功能:正常的打卡功能

问题详细描述(怎么发现的问题):运行 Main.py

终端报错输出(最后几行即可):'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

日志(config.py内log改为Tru后,在log文件夹下查看):

2024-04-11 12:04:38 - root - INFO - 检测到用户数据文件,已加载! - process.py - load_users_from_json - 50
2024-04-11 12:04:38 - root - INFO - 14 - process.py - random_Time - 43
2024-04-11 12:04:52 - root - INFO - 帅妹 随机 14 s - Main.py - main - 21
2024-04-11 12:04:52 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): sxbaapp.zcj.jyt.henan.gov.cn:443 - connectionpool.py - _new_conn - 1055
2024-04-11 12:04:52 - urllib3.connectionpool - DEBUG - https://sxbaapp.zcj.jyt.henan.gov.cn:443 "POST /api/getApitoken.ashx HTTP/1.1" 200 278 - connectionpool.py - _make_request - 549
2024-04-11 12:04:52 - root - INFO - XXXX= - process.py - get_Apitoken - 121
2024-04-11 12:04:52 - root - INFO - <hmac.HMAC object at 0x7f2925d9aa20> - process.py - calculate_hmac_sha256 - 62
2024-04-11 12:04:52 - root - INFO - XXXX - process.py - calculate_sign - 145
2024-04-11 12:04:52 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): r.app.xiaomi.com:443 - connectionpool.py - _new_conn - 1055
2024-04-11 12:04:52 - urllib3.connectionpool - DEBUG - https://r.app.xiaomi.com:443 "GET /details?id=com.wyl.exam HTTP/1.1" 200 None - connectionpool.py - _make_request - 549
2024-04-11 12:04:52 - root - INFO - {'Accept': '*/*', 'timestamp': '1712837092951', 'cl_ip': '192.168.range(0, 255).range(0, 255)', 'os': 'android', 'Accept-Encoding': 'gzip', 'Accept-Language': 'zh-Hans-CN;q=1', 'Content-Type': 'application/json; charset=UTF-8', 'User-Agent': 'okhttp/3.14.9', 'Connection': 'keep-alive', 'phone': '华为', 'token': 'XXXX', 'Sign': 'XXXX', 'appVersion': '1.4.7'} - process.py - generate_headers - 107
2024-04-11 12:04:52 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): sxbaapp.zcj.jyt.henan.gov.cn:443 - connectionpool.py - _new_conn - 1055
2024-04-11 12:05:24 - root - INFO - 帅妹 的返回值为('登录失败!', "帅妹,'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)\n剩余时间:249天", '未在推送时效!') - Main.py - main - 26
2024-04-11 12:05:24 - root - INFO - 邮件发送失败!错误描述:[Errno -2] Name or service not known - Main.py - main - 39
image
zycn0910 commented 7 months ago

config.yaml里面设置的什么

zkeq commented 7 months ago

config.yaml里面设置的什么

没有改动过其他的

就改了一个 log_report: True

大佬可以用Codespaces 跑跑试试... 我刚试了就是这个报错..

zycn0910 commented 7 months ago

你的手机型号改成HUAWEI,requests的post请求数据内默认不能有中文

zkeq commented 7 months ago

你的手机型号改成HUAWEI,requests的post请求数据内默认不能有中文

牛逼 感谢大佬 解决了