| 
 | 
 
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册  
 
x
 
import urllib.request 
 
url='http:;//www.whatismyip.com。tw' 
 
proxy_support=urllib.request.ProxyHandler({'http':'171.35.169.191:9999'}) 
 
opener=urllib.request.build_opener(proxy_support) 
opener.addhead=[('User-Agent','Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Mobile Safari/537.36 Edg/86.0.622.63')] 
 
urllib.request.install_opener(opener) 
 
response=urllib.request.urlopen(url) 
 
html=response.read().decode('utf-8') 
 
print(html) 
看不懂错在哪里 
 
================= RESTART: C:\Users\ccj\Desktop\python\proxy.py ================ 
Traceback (most recent call last): 
  File "C:\Users\ccj\Desktop\python\proxy.py", line 12, in <module> 
    response=urllib.request.urlopen(url) 
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 222, in urlopen 
    return opener.open(url, data, timeout) 
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 522, in open 
    req = meth(req) 
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 1274, in do_request_ 
    raise URLError('no host given') 
urllib.error.URLError: <urlopen error no host given> 
>>>  |   
 
 
 
 |