Add sleep(3s) to send images

This commit is contained in:
Kiryl
2021-12-01 14:21:34 +03:00
parent a5f2a47edf
commit ccd18fed7a
2 changed files with 41 additions and 25 deletions

View File

@@ -33,7 +33,8 @@ def update_src_links_in_images(body_tag: Tag,
href2img_content: dict,
path_to_html,
access=None,
path2aws_path=None):
path2aws_path=None,
book_id=None):
img_tags = body_tag.find_all('img')
for img in img_tags:
@@ -51,11 +52,11 @@ def update_src_links_in_images(body_tag: Tag,
new_folder = path2aws_path[path_to_img_from_root]
else:
new_folder = save_image_to_aws(
access, path_to_img_from_root, img_content, 'book_id')
access, path_to_img_from_root, img_content, book_id)
path2aws_path[path_to_img_from_root] = new_folder
else:
new_folder = save_image_locally(
path_to_img_from_root, img_content, 'book_id')
path_to_img_from_root, img_content, book_id)
img.attrs['src'] = str(new_folder)
if img.attrs.get('width'):