当前位置:网站首页>可下载视频可下载图片的函数
可下载视频可下载图片的函数
2022-07-31 05:17:00 【'番茄炒蛋饭'】
可下载视频可下载图片的函数
可下载视频可下载图片
import requests
def download_video(url, path):
try:
r = requests.get(url, stream=True)
if r.status_code == 200:
with open(path, mode='wb') as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
print("download succeed")
# Debug.logger.debug(f"download succeed")
else:
print(f"接口没有返回参数==={
url}")
# Debug.logger.debug(f"接口没有返回参数==={url}")
except:
# Debug.logger.debug(f"download failed2 未知错误==={url}")
print(f"download failed2 未知错误==={
url}")
pass
if __name__ == '__main__':
url = "http://192.168.12.xxx/score/3.jpg"
path = r"1.jpg"
download_video(url, path)
pass
边栏推荐
猜你喜欢

DSPE-PEG-Azide DSPE-PED-N3 磷脂-聚乙二醇-叠氮脂质PFG

Tensorflow steps on the pit while using it

Pytorch study notes 7 - processing input of multi-dimensional features

Pytorch常用函数

Cholesterol-PEG-Thiol CLS-PEG-SH Cholesterol-Polyethylene Glycol-Sulfhydryl

MySQL 主从切换步骤

The content of the wangeditor editor is transferred to the background server for storage

Remote file xxx is mapped to the local path xxx and can‘t be found. You can continue debugging....

Wangeditor rich text editor to upload pictures and solve cross-domain problems

crontab timing operation
随机推荐
mysql 事务原理详解
mPEG-DMPE 甲氧基-聚乙二醇-双肉豆蔻磷脂酰乙醇胺用于形成隐形脂质体
IDEA概述和安装及调试
【Rhapsody学习笔记】4:Relations
CLS-PEG-FITC Fluorescein-PEG-CLS 胆固醇-聚乙二醇-荧光素简介
ROS 之订阅多个topic时间同步问题
十分钟教你玩转分支语句!!!!!小白速进,新手福利!!
DC-CDN学习笔记
mPEG-DSPE 178744-28-0 甲氧基-聚乙二醇-磷脂酰乙醇胺线性PEG磷脂
mPEG-DSPE 178744-28-0 Methoxy-polyethylene glycol-phosphatidylethanolamine linear PEG phospholipids
深度学习知识点杂谈
Pytorch学习笔记13——Basic_RNN
活体检测FaceBagNet阅读笔记
crontab的定时操作
Jupyter内核正忙、内核挂掉
Remote file xxx is mapped to the local path xxx and can‘t be found. You can continue debugging....
MySQL free installation download and configuration tutorial
Shell/Vim related list
Pytorch study notes 7 - processing input of multi-dimensional features
Numpy常用函数