feat: end-point for deal document generation

This commit is contained in:
2024-09-20 20:02:17 +04:00
parent 03aba9649a
commit 5316f7f9ce
9 changed files with 482 additions and 5 deletions

20
utils/images_fetcher.py Normal file
View File

@@ -0,0 +1,20 @@
import asyncio
import base64
from typing import List, Tuple
import aiohttp
async def fetch_image(url: str) -> str:
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
if response.status == 200:
image_data = await response.read()
return base64.b64encode(image_data).decode("utf-8")
else:
return ""
async def fetch_images(urls: List[str]) -> Tuple[str]:
tasks = [fetch_image(url) for url in urls]
return await asyncio.gather(*tasks)