from urllib.request import urlopen
from urllib.request import Request,build_opener,HTTPHandler,ProxyHandler
from urllib.parse import urlencode
import ssl
url = "http://httpbin.org/get"
headers={
'User-Agent':'Mozilla/5.0(Windows;U;WindowsNT6.1;en-us)AppleWebKit/534.50(KHTML,likeGecko)Version/5.1Safari/534.50'
}
request = Request(url, headers=headers)
#handle=HTTPHandler()
handle=ProxyHandler('http','ip')
opener=build_opener(handle)
response = opener.open(request)
info = response.read().decode()
print(info)
(5)爬虫ip代理设置
最新推荐文章于 2024-08-30 17:58:37 发布