Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行不成功,能帮我看看是什么问题吗? #86

Open
realcsnake2023 opened this issue Dec 6, 2024 · 2 comments
Open

运行不成功,能帮我看看是什么问题吗? #86

realcsnake2023 opened this issue Dec 6, 2024 · 2 comments

Comments

@realcsnake2023
Copy link

首先十分感谢icepage大佬的代码!!
但可能是我哪里出了问题(毕竟小白一个),所以还是运行不成功。

运行时显示如下错误:

root@test-fnOS:/vol1/1000/docker-app/jingdong#
root@test-fnOS:/vol1/1000/docker-app/jingdong# docker run -i -v $PWD/config.py:/app/config.py icepage/aujc:latest python main.py
2024-12-06 23:09:18.915 | INFO     | __main__:get_ql_api:504 - 开始获取QL登录态......
2024-12-06 23:09:18.916 | INFO     | __main__:get_ql_api:510 - 使用client_id和client_secret登录......
2024-12-06 23:09:18.939 | INFO     | __main__:get_ql_api:514 - client_id和client_secret正常可用......
2024-12-06 23:09:18.948 | INFO     | __main__:main:557 - 获取环境变量成功
2024-12-06 23:09:19.229 | INFO     | __main__:main:582 - 开始更新10****36
2024-12-06 23:09:19.229 | INFO     | __main__:get_jd_pt_key:393 - 未配置代理
2024-12-06 23:09:28.626 | INFO     | __main__:get_jd_pt_key:480 - 等待获取cookie...
Traceback (most recent call last):
  File "/app/main.py", line 481, in get_jd_pt_key
    await page.wait_for_selector('#msShortcutMenu', state='visible', timeout=120000)
  File "/usr/local/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 7999, in wait_for_selector
    await self._impl_obj.wait_for_selector(
  File "/usr/local/lib/python3.10/site-packages/playwright/_impl/_page.py", line 397, in wait_for_selector
    return await self._main_frame.wait_for_selector(**locals_to_params(locals()))
  File "/usr/local/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 323, in wait_for_selector
    await self._channel.send("waitForSelector", locals_to_params(locals()))
  File "/usr/local/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "/usr/local/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 514, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Page.wait_for_selector: Timeout 120000ms exceeded.
Call log:
waiting for locator("#msShortcutMenu") to be visible

2024-12-06 23:11:28.702 | ERROR    | __main__:main:585 - 获取pt_key失败


以下是我的配置文件config.py

# JD用户信息
user_datas = {
    # QQ账号
    "10******36": {
        # qq密码
        "password": "****",
        "pt_pin": "jd_******",
        # 指定为qq账号
        "user_type": "qq",
        "force_update": True
    },
}

# ql信息
qinglong_data = {
    "url": "http://192.168.***:5701/",
    "client_id": "5S****",
    "client_secret": "-aeE****",
    "username": "admin",
    "password": "123456",
    # 可选参数,QL面板的sessionid,主要是避免抢占QL后台的登录。需要在浏览器上,F12上获取Authorization的请求头。如果为空或不设置则账号密码登录
    "token": ""
}

# 定时器
cron_expression = "0 5-6 * * *"

# 浏览器是否开启无头模式,即是否展示整个登录过程
headless = True

# 是否开启发消息
is_send_msg = False
# 更新成功后是否发消息的开关
is_send_success_msg = True
# 更新失败后是否发消息的开关
is_send_fail_msg = True
# 配置发送地址
send_info = {
    "send_wecom": [
        "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=be******"
    ]
}

# sms_func为填写验信验证码的模式,有3种可选,如下:
# no 关闭短信验证码识别
# manual_input 手动在终端输入验证码
# webhook 调用api获取验证码,可实现全自动填写验证码
sms_func = "manual_input"
sms_webhook = "https://127.0.0.1:3000/getCode"

# 代理的配置,只代理登录,不代理请求QL面板和发消息
proxy = {
    # 代理服务器地址, 支持http, https, socks5
    "server": "http://",
    # 代理服务器账号
    "username": "",
    # 代理服务器密码
    "password": ""
}


能帮我看看这是哪里配置不正确吗?谢谢!

@realcsnake2023
Copy link
Author

又试了一次,更新成功了。虽然并不知道怎么回事。但有了新的问题,就是这个脚本如何实现定时运行呢?

@icepage
Copy link
Owner

icepage commented Dec 7, 2024

@realcsnake2023 按照配置文档里的长期运行的内容进行配置和启动

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

No branches or pull requests

2 participants