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

sendNotify.py TG_PROXY_IP 未能实际生效 #64

Open
zhongwangninja opened this issue Aug 9, 2021 · 0 comments
Open

sendNotify.py TG_PROXY_IP 未能实际生效 #64

zhongwangninja opened this issue Aug 9, 2021 · 0 comments

Comments

@zhongwangninja
Copy link

zhongwangninja commented Aug 9, 2021

国内小鸡无法直接访问 TG,需要使用代理,依赖 TG_PROXY_IP, TG_PROXY_PORT,但 sendNotify 没有判断环境中是否有对应参数并获取,而是在后边直接使用了未赋值的本地变量 TG_PROXY_IP,导致 TG_PROXY_IP 实际上永远为空

        if TG_PROXY_IP and TG_PROXY_PORT:
            proxyStr = "http://{}:{}".format(TG_PROXY_IP, TG_PROXY_PORT)
            proxies = {"http": proxyStr, "https": proxyStr}
        try:
            response = requests.post(url=url, headers=headers, params=payload, proxies=proxies).json()

大佬考虑下能否在前边添加对 TG_PROXY_IP 的判断:

if "TG_PROXY_IP" in os.environ and os.environ["TG_PROXY_IP"]:
    TG_PROXY_IP = os.environ["TG_PROXY_IP"]
    TG_PROXY_PORT = os.environ["TG_PROXY_PORT"]

如果加上这段的话,国内小鸡就能够直接使用代理发送 tg 消息,应该也不会影响 github action 用户,使用 action 的朋友一般不会设置 TG_PROXY_IP, TG_PROXY_PORT

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

1 participant