import urllib.request
定义要登陆的网址
url = "http://www.ren.com/967469305/profile"
定义请求头
headers = {
"Host": "www.ren.com",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8",
"Referer": "http://www.ren"
}
发送请求
response = urllib.request.urlopen(url)
输出结果
print(response.read().decode("utf-8"))
暂无评论