设为首页 加入收藏

TOP

使用request下载小说(一)
2017-10-09 17:30:44 】 浏览:8759
Tags:使用 request 下载 小说

 

使用requests

使用requests

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就

首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇python非转基因HTTP请求库--Reque.. 下一篇第 11 章 测试代码

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目