request使用代理

时间:2024-09-30 21:37:20
# *_*coding:utf-8 *_*
import requests url = 'http://test.yeves.cn/test_header.php' params = {'id':'1','name':'海笑磊'}
params = {'key1': 'value1', 'key2': ['value2', 'value3']}
headers = {
'User-Agent':'test'
}
cookies = {'name':'gggg'}
proxies = {
"http": "http://36.36.115.170:8197",
}
response = requests.get(url,params=params,cookies=cookies,allow_redirects=False,proxies=proxies,headers=headers)
print(response)
print(response.status_code)
print(response.encoding)
print(response.headers)
print(response.url)
print(response.json())
print(response.history)