python module_error ai_generated true

DeprecationWarning: 'werkzeug.urls.url_quote' 已弃用,将在 Werkzeug 3.0 中移除。请改用 urllib.parse.quote。

DeprecationWarning: 'werkzeug.urls.url_quote' is deprecated and will be removed in Werkzeug 3.0. Use urllib.parse.quote instead.

ID: python/flask-werkzeug-proxy-fix-deprecated

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2024-01-29首次发现

版本兼容性

版本状态引入弃用备注
3.x active — — —

根因分析

应用代码导入了 Werkzeug 3.x 中已移除的 werkzeug.urls 辅助函数。

English

Application code imports deprecated werkzeug.urls helpers removed in Werkzeug 3.x.

generic

解决方案

  1. 95% 成功率
    from urllib.parse import quote, unquote
    quote('a b')
  2. 80% 成功率
    from werkzeug.urls import url_parse  # still available where applicable

无效尝试

常见但无效的做法:

  1. 85% 失败

    Hides the issue until the import raises ImportError.

  2. 80% 失败

    Blocks other security fixes and modern Flask compat.