![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
爬虫
我就叫贝塔
每天进步一点点
展开
-
selenium获取到网页的整体高度
from selenium import webdriverimport timeimport jsonimport requestsimport reimport randomimport seleniumfrom selenium.webdriver.chrome.service import Service def Func(): # 用webdriver启动谷歌浏览器 s = Service('C:/Users/Fuyic/Desktop/test/chrome原创 2021-10-29 14:49:31 · 2299 阅读 · 2 评论 -
raise_for_status()方法
raise_for_status()方法理解Response类非常重要,Response这样的一个对象返回了所有的网页内容,那么它也提供了一个方法,叫raise_for_status(),这个方法是专门与异常打交道的方法,该方法有这样一个有趣的功能,它能够判断返回的Response类型状态是不是200。如果是200,他将表示返回的内容是正确的,如果不是200,他就会产生一个HttpError的异常。这个代码中我们用r.raise_for_status()方法,它就可以有效的判断网络连接的状态。如果网连原创 2020-07-06 18:05:54 · 2947 阅读 · 0 评论