从 Python 中,我想通过带有基本身份验证的 HTTPS 从网站检索内容。我需要磁盘上的内容。我在 Intranet 上,信任 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 中可能吗?