Requests库

Requests库中,encoding属性代表了从服务器返回HTTP协议头所推荐的编码方式,apparent_encoding属性代表了从服务器返回HTTP协议内容部分猜测的编码方式

在Requests库的get()方法中,能够定制向服务器提交HTTP请求头的参数是headers

Response类的.content属性用于获取网络上某个URL对应的图片或视频等二进制资源

raise_for_status()

Requests库的异常

Python网络爬虫笔记

Requests库的主要方法

Python网络爬虫笔记

BeautifulSoup库

BeautifulSoup类的基本元素:

Tag、Name、Attribute、NavigableString、Comment
Python网络爬虫笔记

标签树下行遍历属性:

.contents //Beautiful Soup库在进行标签树下行遍历时,以列表形式返回儿子节点
.children
.descendants
Python网络爬虫笔记

标签树上行遍历属性:

.parent
.parents
Python网络爬虫笔记

标签树平行遍历属性:

.next_sibling
.previous_sibling
.next_sibling
.previous_siblings
Python网络爬虫笔记

Scrapy

Scrapy结构:
Python网络爬虫笔记
Scrapy常用命令:
Python网络爬虫笔记

request和Scrapy比较:
Python网络爬虫笔记

Request:
Python网络爬虫笔记

Response:
Python网络爬虫笔记

相关文章:

  • 2021-12-20
  • 2021-09-16
  • 2021-12-15
  • 2021-05-02
  • 2021-08-11
  • 2021-07-02
  • 2021-08-03
  • 2021-06-17
猜你喜欢
  • 2021-08-11
  • 2021-09-10
  • 2022-12-23
  • 2021-04-12
  • 2021-09-18
  • 2021-12-15
相关资源
相似解决方案