执行 Ruff 安全自动修复
This commit is contained in:
@@ -20,8 +20,8 @@ from pathlib import Path
|
||||
from urllib.error import HTTPError
|
||||
from urllib.parse import urlencode
|
||||
from urllib.request import (
|
||||
HTTPRedirectHandler,
|
||||
HTTPCookieProcessor,
|
||||
HTTPRedirectHandler,
|
||||
Request,
|
||||
build_opener,
|
||||
)
|
||||
@@ -42,7 +42,7 @@ USER_AGENT = (
|
||||
class NoRedirect(HTTPRedirectHandler):
|
||||
"""保留 OAuth 回调的 302 和 Set-Cookie。"""
|
||||
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl): # noqa: D401
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
return None
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ def extract_uuid(page: str) -> str:
|
||||
r"connect/qrcode/([A-Za-z0-9_-]{8,64})",
|
||||
r"uuid=([A-Za-z0-9_-]{8,64})",
|
||||
):
|
||||
match = re.search(pattern, page, re.I)
|
||||
match = re.search(pattern, page, re.IGNORECASE)
|
||||
if match:
|
||||
return match.group(1)
|
||||
raise ValueError("微信授权页未找到二维码 UUID")
|
||||
|
||||
Reference in New Issue
Block a user