#coding:utf-8 # windows中测试不通过,下载的图片不完整 # 通过多线程下载图片 import requests import threading class downloader(object): def __init__(self): # self.url = 'http://f1.topitme.com/1/eb/96/112730204208796eb1o.jpg' # mysql source package # self.url = 'http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35.tar.gz' # yangmi self.url = 'https://imgsa.baidu.com/baike/c0%3Dbaike116%2C5%2C5%2C116%2C38/sign=18d31e2c6c380cd7f213aabfc02dc651/2e2eb9389b504fc27dcf5199ecdde71191ef6d9e.jpg' # self.name = 'mysql-5.6.35.tar.gz' self.name = 'yangmi.jpg' self.num = 5 def get_img(self, r): # 获取图片的分段位置,并记录seek值(分段后的起始位置)开始写入系统 _request = requests.get(self.url, headers = { 'Range':<
python多线程threading下载示例
最新推荐文章于 2024-04-21 11:41:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)