Skip to content

fix: 增强Token获取的调试功能和风控处理#71

Open
gexiaojun1201 wants to merge 1 commit intoshaxiu:mainfrom
gexiaojun1201:claude/fix-logging-truncation-012drsBWm6cf7qGcoZvqQvEG
Open

fix: 增强Token获取的调试功能和风控处理#71
gexiaojun1201 wants to merge 1 commit intoshaxiu:mainfrom
gexiaojun1201:claude/fix-logging-truncation-012drsBWm6cf7qGcoZvqQvEG

Conversation

@gexiaojun1201
Copy link
Copy Markdown

  • 添加详细的调试日志,显示cookies状态和API响应
  • 增加重试等待时间(2-3秒),避免触发闲鱼风控
  • 新增Cookie诊断工具debug_cookies.py,帮助用户检查Cookie配置

- 添加详细的调试日志,显示cookies状态和API响应
- 增加重试等待时间(2-3秒),避免触发闲鱼风控
- 新增Cookie诊断工具debug_cookies.py,帮助用户检查Cookie配置
@gexiaojun1201
Copy link
Copy Markdown
Author

1

Copy link
Copy Markdown

@JiwaniZakir JiwaniZakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cookie parsing in debug_cookies.py's check_cookies() splits on '; ' (with a trailing space), but real-world Cookie headers sometimes use ';' without a space between pairs — this would silently produce incorrect key names with leading spaces, causing required cookies like cna or unb to appear missing even when present. Consider using cookie.strip().split('=', 1) after splitting on ';' alone.

In XianyuApis.py, the retry wait formula wait_time = 2 + retry_count produces linear backoff (2s, 3s, 4s…), which is weak against rate-limiting scenarios; exponential backoff (e.g., 2 ** retry_count) is the more standard approach for anti-scraping/risk-control situations. Also, the debug lines logging partial cookie values (cna, cookie2, _m_h5_tk) at DEBUG level could expose sensitive auth material in persisted log files — it's worth adding a note in the docstring or a conditional guard so this is only active in explicitly opted-in debug environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants