机械化刮削集管不工作

2024-04-27 13:09:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我正尝试使用Mechanize使用Python浏览网站,但不断出现以下错误:

"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"

我添加了一个标题,但仍然不起作用。我的标题如下所示:

httpproxy = "myproxy@myserver.com"
proxydict = {
            "https": httpproxy,
             "http": httpproxy
             }
url = 'https://www.privateequityinternational.com/BREXIT/'
br = mechanize.Browser()
br.set_proxies(proxydict)
br.set_handle_robots(False)
#br.addheaders = [('Referer', 'http://google.com')]
br.set_handle_equiv(False)
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
br.open(url)

任何帮助都将不胜感激。你知道吗


Tags: httpsbrcomhttpurl标题connectionhandle