hyisangie

2021年9月10日 #

django makemigrations 错误:TypeError: 'module' object is not iterable

摘要: 错误描述: 在执行 python manage.py makemigrations 命令产生迁移文件时,抛出了 TypeError: 'module' object is not iterable 异常,具体信息如下: TypeError: 'module' object is not iterab 阅读全文

posted @ 2021-09-10 16:21 hyisangie 阅读(1525) 评论(0) 推荐(0) 编辑

2021年8月18日 #

”您的连接不是私密连接““SSLError”,爬虫如何处理

摘要: ”您的连接不是私密连接““SSLError”,爬虫如何处理 遇到这种情况的话,爬虫代码不能像在浏览器可以安装证书, 返回 SSLError, 要怎么处理呢? 解决方法: 在请求的时候添加一个参数 → verify=False # 默认是开启验证的,False的话就可以绕过验证 import requ 阅读全文

posted @ 2021-08-18 13:15 hyisangie 阅读(329) 评论(0) 推荐(0) 编辑

2021年8月17日 #

python安装或升级模块时,[WinError 5] 拒绝访问

摘要: 今天在升级模块时,遇到了这个错误 ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'c:\\[路径太长,这里被我删了]\\site-packages\\~umpy\\.libs\\libopenblas 阅读全文

posted @ 2021-08-17 21:50 hyisangie 阅读(39146) 评论(0) 推荐(1) 编辑

matplotlib 显示不出中文

摘要: python中用matplotlib绘制图标的时候,发现中文字体显示不出来。 解决方法就是在matplotlib中设置字体,添加以下代码就好了 import matplotlib matplotlib.rc("font", family='YouYuan') # family= 后面放字体 它支持的 阅读全文

posted @ 2021-08-17 17:53 hyisangie 阅读(246) 评论(0) 推荐(0) 编辑

2021年8月16日 #

爬虫反爬之cookie

摘要: 携带cookie的两种方式 直接将cookie放在请求头headers中一起作为参数 import requests url = 'xxxxxx' headers_ = { 'User-Agent': 'xxxxxxx', 'Cookie': 'xxxxx' } res_ = requests.ge 阅读全文

posted @ 2021-08-16 20:12 hyisangie 阅读(189) 评论(0) 推荐(0) 编辑

2021年8月15日 #

selenium遍历元素时获得重复结果

摘要: 在获取网页源代码之后,对数据进行提取。 def get_goods_info(self): ''' 解析得到商品信息字段 ''' li_list = self.driver.find_elements_by_xpath('//div[@class="lego-pc-search-list pc-se 阅读全文

posted @ 2021-08-15 22:04 hyisangie 阅读(510) 评论(0) 推荐(0) 编辑

爬虫反爬之User-Agent池

摘要: 列表,放多个 User-Agent,每次随机提取 user_agent_list = [ "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 " "(KHTML, like Gecko) Chrome/22.0.1207.1 Safari/5 阅读全文

posted @ 2021-08-15 08:52 hyisangie 阅读(136) 评论(0) 推荐(0) 编辑

2021年8月14日 #

编解码及爬虫获取数据

摘要: 计算机只能识别二进制语言,网络上传输为了方便迅速,数据的类型为字节类型【bytes类型】 python不好操作字节类型的数据,因此要把它变成字符串类型进行操作【string类型】 后端:字符串类型 > 二进制字符串类型【方便网络上数据的传输】编码 encode 了解如何编码: 字符串类型数据.enc 阅读全文

posted @ 2021-08-14 09:04 hyisangie 阅读(151) 评论(0) 推荐(0) 编辑

网络请求的过程

摘要: (1) 客户机输入url(如www.baidu.com)后,会向DNS服务器发送请求 (2) DNS服务器中保存了url域名和IP地址(xxx.xxx.xxx.xxx)的对应关系,它会将对应的IP地址返回 (3) 客户机本质上就是通过IP地址找到对应的web服务器(比如百度的服务器)请求页面 (4) 阅读全文

posted @ 2021-08-14 07:17 hyisangie 阅读(337) 评论(0) 推荐(0) 编辑

response 和 elements 获取内容不同的原因

摘要: **构成完整网页的资源:**html + js + css + jpg等 html:简单理解为文字 js:简单理解为动作,比如点击 css:美观,比如文字的大小颜色 jpg:图片【或其他静态资源】 response 和 elements 内容不同的原因? ​ (1) 一个url请求,只能获取一个对应 阅读全文

posted @ 2021-08-14 07:01 hyisangie 阅读(414) 评论(0) 推荐(0) 编辑

导航