写在前面
安装requests库只需要pip一条命令,安装python编译环境是一定要勾选将pip安装到环境变量的选项。
pip install requests
查看requests库调用方法
import requests
print(dir(requests))
添加代理
r=requests.get(url,proxies=proxies)
proxies是一个字典对象
import requests
url="https://www.baidu.com"
proxies={
"http":"http://127.0.0.1:8080",
"https":"https://127.0.0.1:8080",
}
'''proxies = {
"http": "http://user:[email protected]:3128/",
}
//用于代理有用户和密码使用
'''
#print(dir(requests))
#r=requests.get(url)
r=requests.get(url,proxie