01 2023 档案

摘要:解决方法: 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 阅读(2775) 评论(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:38 kliziM 阅读(816) 评论(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 阅读(103) 评论(1) 推荐(0) 编辑
摘要:# 格式化成2016-03-20 11:45:39形式print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) 阅读全文
posted @ 2023-01-22 21:27 kliziM 阅读(12) 评论(0) 推荐(0) 编辑
摘要:Python的异常机制主要依赖 try、except、else、finally和raise五个关键字, 其中在try关键字后缩进的代码块简称try块,它里面放置的是可能引发异常的代码; 在except后对应的是异常类型和一个代码块,用于表明该except块处理这种类型的代码; 在多个except块之 阅读全文
posted @ 2023-01-21 22:53 kliziM 阅读(46) 评论(0) 推荐(0) 编辑
摘要:##########################################################源代码中因为返回的是跳转url,所以写的是resp.text,本案中resp返回的是文件,所以直接返回resp.content原类型#在其他案例中,如果返回的是下载url,则应该写成r 阅读全文
posted @ 2023-01-16 16:26 kliziM 阅读(71) 评论(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 阅读(2848) 评论(0) 推荐(0) 编辑
摘要:在pycharm终端, pip freeze > requirements.txt 阅读全文
posted @ 2023-01-02 17:06 kliziM 阅读(23) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示