fix: added default product image, removed empty tables prints, fixed barcode output

This commit is contained in:
2024-09-23 01:24:43 +04:00
parent 973351a3af
commit 52681f3f61
4 changed files with 88 additions and 62 deletions

View File

@@ -1,11 +1,14 @@
import asyncio
import base64
from typing import List, Tuple
from typing import List, Tuple, Optional
import aiohttp
async def fetch_image(url: str) -> str:
async def fetch_image(url: Optional[str]) -> str:
if not url:
return ""
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
if response.status == 200:
@@ -15,6 +18,6 @@ async def fetch_image(url: str) -> str:
return ""
async def fetch_images(urls: List[str]) -> Tuple[str]:
async def fetch_images(urls: List[Optional[str]]) -> Tuple[str]:
tasks = [fetch_image(url) for url in urls]
return await asyncio.gather(*tasks)