0
我尝试做以下请求模块:的Python:我如何使用的urllib或从企业域(防火墙,代理服务器,cntlm等)
from urllib.request import urlopen
data = urlopen("https://www.duolingo.com/users/SaifullahS6").read()
我收到以下错误:
URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
同样,当我试试这个:
import requests
session = requests.Session()
data = {"login": "SaifullahS6", "password": "mypassword"}
req = requests.Request('POST', "https://www.duolingo.com/login", data=data,
cookies=session.cookies)
prepped=req.prepare()
returned = session.send(prepped)
我得到:
ConnectionError: HTTPSConnectionPool(host='www.duolingo.com', port=443): Max retries exceeded with url: /login (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000000000E6948D0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))
我不知道如何提供我的互联网连接的详细信息。
- 我在工作,我知道我们有一个公司代理。
- 我们必须打开Windows防火墙,但我已经检查了Python和pythonw在控制面板中的“域”列中勾选允许程序通过防火墙。
- 当我从命令shell ping google.co.uk时,所有四个请求超时,但我可以从浏览器访问它。
- 在Internet选项控制面板,我点击连接选项卡,然后LAN设置,我有“自动检测设置”开启,并且也“使用代理服务器为LAN”,“地址”为“本地主机“和”港口“是3128.这是cntlm。我建立了一次下载python软件包,它似乎仍然是活跃的,因为我刚刚设法更新我的一个软件包。
我甚至都不需要直接回答我的问题;在这一点上,我只是想澄清一下在幕后实际发生的事情。任何帮助非常感谢!