|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我按照鱼C的教程把代码写了一遍可是我运行的时候出现了错误,
运行的错误为:urllib.error.URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>
求各位帮帮忙看看如何解决!!!~
- #coding=utf-8
- import urllib.request
- url ="http://www.whatismyip.com.tw/"
- proxy_support =urllib.request.ProxyHandler({"http":"58.222.254.11:3128"})
- opener =urllib.request.build_opener(proxy_support)
- opener.addheaders=[("User-Agent","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.8.1000 Chrome/30.0.1599.101 Safari/537.36")]
- urllib.request.install_opener(opener)
- response =urllib.request.urlopen(url)
- html =response.read().decode("utf-8")
- print(html)
复制代码
|
|