import urllib.request
url='http://httpbin.org/ip'
#不使用代理
response1=urllib.request.urlopen(url)
#设置代理
handler=urllib.request.ProxyHandler({'httpi':'218.65.67.16:9000'})
opener=urllib.request.build_opener(handler)
response2=opener.open(url)
1.除去url,不使用代理只需要1步,使用代理需要3步
2.不使用代理就像一个真人直接去拿一个苹果(url),使用代理就像一个木偶(代理)需要真人去控制(build_opener),获得木偶控制权,然后去拿苹果