mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-05-05 23:41:16 +00:00
make log_exception optional for s3 file download - there are expected cases when the file is not there and the function returns None (#511)
This commit is contained in:
parent
ccaf34c49b
commit
f2ceb9f88d
1 changed files with 3 additions and 2 deletions
|
|
@ -65,13 +65,14 @@ class AsyncAWSClient:
|
|||
LOG.exception("S3 upload failed.", uri=uri)
|
||||
|
||||
@execute_with_async_client(client_type=AWSClientType.S3)
|
||||
async def download_file(self, uri: str, client: AioBaseClient = None) -> bytes | None:
|
||||
async def download_file(self, uri: str, client: AioBaseClient = None, log_exception: bool = True) -> bytes | None:
|
||||
try:
|
||||
parsed_uri = S3Uri(uri)
|
||||
response = await client.get_object(Bucket=parsed_uri.bucket, Key=parsed_uri.key)
|
||||
return await response["Body"].read()
|
||||
except Exception:
|
||||
LOG.exception("S3 download failed", uri=uri)
|
||||
if log_exception:
|
||||
LOG.exception("S3 download failed", uri=uri)
|
||||
return None
|
||||
|
||||
@execute_with_async_client(client_type=AWSClientType.S3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue