gpt4 book ai didi

通过代理进行基本身份验证的 Python HTTPS 客户端

转载 作者:太空宇宙 更新时间:2023-11-03 13:53:57 26 4
gpt4 key购买 nike

在 Python 中,我想通过具有基本身份验证的 HTTPS 从网站检索内容。我需要磁盘上的内容。我在内联网上,信任 HTTPS 服务器。平台是 Windows 上的 Python 2.6.2。

我一直在玩 urllib2,但到目前为止没有成功。

我有一个正在运行的解决方案,通过 os.system() 调用 wget:

wget_cmd = r'\path\to\wget.exe -q -e "https_proxy = http://fqdn.to.proxy:port" --no-check-certificate --http-user="username" --http-password="password" -O path\to\output https://fqdn.to.site/content'

我想摆脱 os.system()。这在 Python 中可能吗?

最佳答案

代理和 https 不工作 for a long time与 urllib2。它将在下一个发布的 python 2.6 (v2.6.3) 版本中修复。

与此同时,您可以重新实现正确的支持,这就是我们为 mercurial 所做的:http://hg.intevation.org/mercurial/crew/rev/59acb9c7d90f

关于通过代理进行基本身份验证的 Python HTTPS 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1453264/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com