Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
今天新增加了gotify推送方式后发现无法更新cookie了,换浏览器、重新登录都无法获取新的cookie,删除项目重新fork还是一样,看了下返回信息,微信读书似乎对renewal 接口增加了额外的验证,read 接口直接请求是成功的 ,但 renewal 接口鉴权失败 。稍微修改了一下:
main.py 的修改:
新增 test_cookie_valid() 函数
使用 read 接口直接测试 cookie 是否有效
绕过 renewal 接口的鉴权问题
修改 refresh_cookie() 函数
先尝试 renewal 接口
如果失败,再测试 read 接口
只要有一个成功,就继续阅读
修改初始验证逻辑
启动时先用 test_cookie_valid() 测试 cookie
如果有效,直接开始阅读
如果无效,再尝试刷新
修复编码问题
所有 requests.post 的数据都使用 .encode('utf-8')
避免中文编码错误
添加超时设置
防止请求卡住