摘要: 禁止图片和视频的加载:提升网页加载速度。添加代理:用于FQ访问某些页面,或者应对IP访问频率限制的反爬技术。使用移动头:访问移动端的站点,一般这种站点的反爬技术比较薄弱。添加扩展:像正常使用浏览器一样的功能。设置编码:应对中文站,防止乱码。阻止JavaScript执行 Chrome Options是 阅读全文
posted @ 2023-09-14 21:25 kliziM 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 解决方法: requests.get(url_file, stream=True)在requests函数中增加stream=True参数,问题解决 爬虫运行时报:'Connection broken: IncompleteRead(1482 bytes read, 2614 more expecte 阅读全文
posted @ 2023-01-29 16:06 kliziM 阅读(1319) 评论(0) 推荐(0) 编辑
摘要: python3 获取request 302跳转后最终的URL 代码: import requests resp = requests.get(rtsp_url, timeout=(3, 7)) if len(resp.history) > 0: location_url = resp.history 阅读全文
posted @ 2023-01-23 13:39 kliziM 阅读(740) 评论(0) 推荐(0) 编辑
摘要: import time import requests import requests.cookies # 格式化成2016-03-20 11:45:39形式 print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) print(time 阅读全文
posted @ 2023-01-22 21:54 kliziM 阅读(88) 评论(1) 推荐(0) 编辑
摘要: # 格式化成2016-03-20 11:45:39形式print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) 阅读全文
posted @ 2023-01-22 21:28 kliziM 阅读(7) 评论(0) 推荐(0) 编辑
摘要: Python的异常机制主要依赖 try、except、else、finally和raise五个关键字, 其中在try关键字后缩进的代码块简称try块,它里面放置的是可能引发异常的代码; 在except后对应的是异常类型和一个代码块,用于表明该except块处理这种类型的代码; 在多个except块之 阅读全文
posted @ 2023-01-21 22:54 kliziM 阅读(33) 评论(0) 推荐(0) 编辑
摘要: ##########################################################源代码中因为返回的是跳转url,所以写的是resp.text,本案中resp返回的是文件,所以直接返回resp.content原类型#在其他案例中,如果返回的是下载url,则应该写成r 阅读全文
posted @ 2023-01-16 16:26 kliziM 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 首席引入依赖安装waitrss pip intsll waitress 然后在flask程序内引入依赖 使用server()函数代替app.run()函数 启动时,直接python xxx.py即可 from waitress import serve from flask import Flask 阅读全文
posted @ 2023-01-09 21:50 kliziM 阅读(2241) 评论(0) 推荐(0) 编辑
摘要: 在pycharm终端, pip freeze > requirements.txt 阅读全文
posted @ 2023-01-02 17:06 kliziM 阅读(22) 评论(0) 推荐(0) 编辑
摘要: https://cloud.tencent.com/developer/article/1740752 下载 # 下载源码包至`opt`目录 wget -c -P /opt https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz # 解 阅读全文
posted @ 2022-12-13 17:18 kliziM 阅读(146) 评论(0) 推荐(0) 编辑