使用requests
Table of Contents
1 使用rquests
1.1 官方快速指导文档(最新版本,使用特定版本时注意版本号)
http://docs.python-requests.org/zh_CN/latest/user/quickstart.html#id2
1.2 打开一个网址
res = requests.get(url)
1.3 发送其他请求
1.3.1 发送post请求请使用requests.post(url)
1.3.2 类似的,需要发送何种请求应该使用该种方法
如: requests.put() requests.delete() requests.put() requests.options()
1.3.3 包含cookies 在浏览器中得到cookies,传递给get(url,cookies=cookies)
在chrome中获取cookies 在需要获取的页面上点开右上角竖着排列的三个点 更多工具–>开发者工具 NetWork中的name中的Headers中带有cookies
例如:微博登录的cookies就