|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import urllib.request
url = 'http://45.32.164.128/ip.php'
response = urllib.request.urlopen(url)
print(response.read().decode('utf-8'))
proxy_support = urllib.request.ProxyHandler({'http': '113.59.99.138:8910'})
opener = urllib.request.build_opener(proxy_support)
opener.addheaders[('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36')]
response = opener.open(url)
print(response.read().decode('utf-8'))
file:///C:/Users/汪振/AppData/Roaming/Tencent/Users/1281359990/QQ/WinTemp/RichOle/Q@7C%25$IN7O8G]E@XCW%60CYEO.png报错:
Traceback (most recent call last):
opener = opener.addheaders[('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36')]
TypeError: list indices must be integers or slices, not tuple
|
|