Skip to content

Commit

Permalink
touch up s3 upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantAnxiety committed Dec 24, 2024
1 parent e051b9e commit 1cd632e
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/dl_s3/dl_s3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@ async def upload_to_s3_by_presigned(

async with aiohttp.ClientSession() as session:
with aiohttp.MultipartWriter("form-data") as mpwriter:
for k, v in upload_url_fields.items():
part = mpwriter.append(
v, {"Content-Type": "text/plain", "Content-Disposition": f'attachment; name="{k}"'}
)
part.set_content_disposition("form-data", name=k)

part = mpwriter.append(
data, {"Content-Type": "text/plain", "Content-Disposition": 'attachment; filename="mydata"'}
)
part.set_content_disposition("form-data", name="file")
for key, value in upload_url_fields.items():
mpwriter.append(value, {"Content-Disposition": f'form-data; name="{key}"'})

mpwriter.append(data, {"Content-Disposition": 'form-data; name=file; filename="mydata"'})

async with session.post(
url=upload_url,
Expand Down

0 comments on commit 1cd632e

Please sign in to comment.