requests应用,代理
程序员文章站
2022-05-08 09:59:13
...
对于requests包的调用
import requests
url = 'http://www.xicidaili.com'
proxy = {
'http':'http://root:[email protected]:8118'
}
user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36'
headers = {
'User-Agent':user_agent
}
response = requests.get(url,headers=headers,proxies=proxy)
print(response.text)