Commit 682e20a2 by baiquan

移除设置token

parent 3281a0ab
......@@ -97,27 +97,6 @@ async def page_login(browser_id):
break
except Exception as e:
logger.error(f"{browser_id}-->{e}")
tab.wait(10)
# 使用正则提取 token
token_pattern = r'"token":\s*"([a-f0-9]{32})"'
token_match = re.search(token_pattern, tab.html)
if token_match:
token = token_match.group(1)
# 设置 30 天后过期
expires = (datetime.now() + timedelta(days=30)).strftime("%a, %d %b %Y %H:%M:%S GMT")
cookies = (
f'_shop_token_={token}; '
'path=/; '
'domain=.fxg.jinritemai.com; '
f'expires={expires}; ' # 指定过期时间
'Secure; ' # 仅 HTTPS 传输
'HttpOnly' # 禁止 JS 访问
)
tab.set.cookies(cookies)
else:
raise AppError("未找到 token")
tab.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment