V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
fangwenxue
V2EX  ›  问与答

win10 设置了代理,浏览器正常,代码不正常

  •  
  •   fangwenxue · 2022-01-10 19:38:08 +08:00 · 1037 次点击
    这是一个创建于 830 天前的主题,其中的信息可能已经有所发展或是发生改变。

    proxies = {'http': 'http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}
    # 手动设置代理正常
    response = requests.get('https://api.telegram.org', timeout=5, proxies=proxies)
    # 异常
    response = requests.get('https://api.telegram.org', timeout=5)
    print(response.text)
    

    以前 clash 开了 system proxy 网页跟代码都是正常的,最近重装了 WIN10 程序不好使了,是还有什么设置?

    5 条回复    2022-01-11 09:04:03 +08:00
    ysc3839
        1
    ysc3839  
       2022-01-10 20:36:48 +08:00 via Android
    绝大多数命令行软件不会使用系统的代理设置,只会读取 http(s)_proxy 等环境变量。
    Tumblr
        2
    Tumblr  
       2022-01-10 20:51:46 +08:00
    netsh winhttp show proxy
    看看有没有 proxy 设置显示出来呢。
    beeeeeeat
        3
    beeeeeeat  
       2022-01-10 23:41:33 +08:00 via iPhone
    是不是 urllib3 的问题,更到 1.26 后有 SSL 异常
    xiyuesaves
        4
    xiyuesaves  
       2022-01-11 08:50:30 +08:00
    用的 clash 的话试试 TUN 模式吧
    fangwenxue
        5
    fangwenxue  
    OP
       2022-01-11 09:04:03 +08:00
    @beeeeeeat
    确实,requests 降级后正常了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1015 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:12 · PVG 03:12 · LAX 12:12 · JFK 15:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.