I started writing proxy to work with S3 through aioboto3 and wanted to implement stream uploading but faced a problem.
async def put(self, bucket, key, stream): conf = boto3.s3.transfer.TransferConfig(multipart_threshold=10000, max_concurrency=4) async with self.client as s3: await s3.upload_fileobj(stream, bucket, key, Config=conf)
upload_fileobj accepts any file-like object which has
read method (also may be awaitable).
read method, but boto3 passes a bytes quantity to it which raises an exception because
request.stream.read doesn’t accept any args.
Could someone please explain is it even possible for network streaming (not Sanic but HTTP standart in general) to specify how much bytes to read? If so, is there any plans to implement it in Sanic?
P.S. I know that I can simple save file and than pass it to boto3 but it is extra actions