Implement FileURLParserBlock and FILE_URL WorkflowParameterType (#559)

This commit is contained in:
Kerem Yilmaz 2024-07-05 17:08:20 -07:00 committed by GitHub
parent 8be94d7928
commit 6929a1d24d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 135 additions and 19 deletions

View file

@ -9,10 +9,18 @@ import structlog
from skyvern.constants import REPO_ROOT_DIR
from skyvern.exceptions import DownloadFileMaxSizeExceeded
from skyvern.forge.sdk.api.aws import AsyncAWSClient
LOG = structlog.get_logger()
async def download_from_s3(client: AsyncAWSClient, s3_uri: str) -> str:
downloaded_bytes = await client.download_file(uri=s3_uri)
file_path = tempfile.NamedTemporaryFile(delete=False)
file_path.write(downloaded_bytes)
return file_path.name
async def download_file(url: str, max_size_mb: int | None = None) -> str:
try:
async with aiohttp.ClientSession(raise_for_status=True) as session: