fix
This commit is contained in:
1 parent
8ba3c166ad
commit
1199bd46ef
1 file changed
+2
-2
+2
-2
@@ -68,7 +68,7 @@ def download_image(image_url, dst_dir, file_name, timeout=20, proxy_type=None, p
|
|||||||
print("## Fail: {} {}".format(image_url, e.args))
|
print("## Fail: {} {}".format(image_url, e.args))
|
||||||
|
|
||||||
|
|
||||||
def download_images(image_urls, dst_dir,timeout=20,concurrency=5, proxy_type=None, proxy=None,files_name=None):
|
def download_images(image_urls, dst_dir,timeout=20, proxy_type=None, proxy=None,files_name=None):
|
||||||
"""
|
"""
|
||||||
Download image according to given urls and automatically rename them in order.
|
Download image according to given urls and automatically rename them in order.
|
||||||
:param timeout:
|
:param timeout:
|
||||||
@@ -80,6 +80,7 @@ def download_images(image_urls, dst_dir,timeout=20,concurrency=5, proxy_type=Non
|
|||||||
:param concurrency: number of requests process simultaneously
|
:param concurrency: number of requests process simultaneously
|
||||||
:return: none
|
:return: none
|
||||||
"""
|
"""
|
||||||
|
concurrency = len(image_urls)
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=concurrency) as executor:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=concurrency) as executor:
|
||||||
future_list = list()
|
future_list = list()
|
||||||
count = 0
|
count = 0
|
||||||
@@ -90,7 +91,6 @@ def download_images(image_urls, dst_dir,timeout=20,concurrency=5, proxy_type=Non
|
|||||||
future_list.append(executor.submit(
|
future_list.append(executor.submit(
|
||||||
download_image, image_url, dst_dir, file_name, timeout, proxy_type, proxy))
|
download_image, image_url, dst_dir, file_name, timeout, proxy_type, proxy))
|
||||||
count += 1
|
count += 1
|
||||||
time.sleep(1)
|
|
||||||
concurrent.futures.wait(future_list, timeout)
|
concurrent.futures.wait(future_list, timeout)
|
||||||
|
|
||||||
def download_comic_icon():
|
def download_comic_icon():
|
||||||
|
|||||||
Reference in new issue
Block a user