Skip to content

Commit b3d0076

Browse files
fix url types
1 parent 6eb3bf7 commit b3d0076

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/aws-library/src/aws_library/s3/_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def create_single_presigned_download_link(
255255
bucket: S3BucketName,
256256
object_key: S3ObjectKey,
257257
expiration_secs: int,
258-
) -> AnyUrl:
258+
) -> str:
259259
# NOTE: ensure the bucket/object exists, this will raise if not
260260
await self._client.head_bucket(Bucket=bucket)
261261
await self._client.head_object(Bucket=bucket, Key=object_key)
@@ -264,20 +264,20 @@ async def create_single_presigned_download_link(
264264
Params={"Bucket": bucket, "Key": object_key},
265265
ExpiresIn=expiration_secs,
266266
)
267-
return AnyUrlLegacyAdapter.validate_python(generated_link)
267+
return f"{AnyUrlLegacyAdapter.validate_python(generated_link)}"
268268

269269
@s3_exception_handler(_logger)
270270
async def create_single_presigned_upload_link(
271271
self, *, bucket: S3BucketName, object_key: S3ObjectKey, expiration_secs: int
272-
) -> AnyUrl:
272+
) -> str:
273273
# NOTE: ensure the bucket/object exists, this will raise if not
274274
await self._client.head_bucket(Bucket=bucket)
275275
generated_link = await self._client.generate_presigned_url(
276276
"put_object",
277277
Params={"Bucket": bucket, "Key": object_key},
278278
ExpiresIn=expiration_secs,
279279
)
280-
return AnyUrlLegacyAdapter.validate_python(generated_link)
280+
return f"{AnyUrlLegacyAdapter.validate_python(generated_link)}"
281281

282282
@s3_exception_handler(_logger)
283283
async def create_multipart_upload_links(

packages/aws-library/tests/test_s3_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ async def test_create_single_presigned_download_link(
694694
object_key=with_uploaded_file_on_s3.s3_key,
695695
expiration_secs=default_expiration_time_seconds,
696696
)
697-
assert isinstance(download_url, AnyUrl)
697+
assert download_url
698698

699699
dest_file = tmp_path / faker.file_name()
700700
async with ClientSession() as session:
701-
response = await session.get(str(download_url))
701+
response = await session.get(download_url)
702702
response.raise_for_status()
703703
with dest_file.open("wb") as fp:
704704
fp.write(await response.read())
@@ -744,7 +744,7 @@ async def test_create_single_presigned_upload_link(
744744
create_file_of_size: Callable[[ByteSize], Path],
745745
default_expiration_time_seconds: int,
746746
upload_to_presigned_link: Callable[
747-
[Path, AnyUrl, S3BucketName, S3ObjectKey], Awaitable[None]
747+
[Path, str, S3BucketName, S3ObjectKey], Awaitable[None]
748748
],
749749
):
750750
file = create_file_of_size(_BYTE_SIZE_ADAPTER.validate_python("1Mib"))

0 commit comments

Comments
 (0)