Cannot download file using download_file() method
PFernandezTorres opened this issue · comments
I have tried downloading a file using the method described in the title but the behaviour is not the expected. The file downloads as it is supposed to, but when it finishes an exception is thrown saying:
.
This is current code:
class AWSS3Controller:
def __init__(self):
self.__session = aioboto3.Session()
async def download(self, filename, supply_id, action):
async with self.__session.client("s3", region_name=os.getenv("AWS_REGION_NAME")) as s3:
if isinstance(filename, str):
await s3.download_file(os.getenv("AWS_BUCKET_NAME"), f'{action}/{supply_id}/{filename}', filename)
else:
for name in filename:
await s3.download_file(os.getenv("AWS_BUCKET_NAME"), f'{action}/{supply_id}/{filename}', name)
As there is no more documentation, I don't know to keep going. Also I have tried declaring a client variable but another exception is thrown that the client is not awaited
The env variable Wass not set...