How to use asyncio to download files on s3 bucket
问题 I'm using the following code to download all my files in a s3 bucket: def main(bucket_name, destination_dir): bucket = boto3.resource('s3').Bucket(bucket_name) for obj in bucket.objects.all(): if obj.key.endswith('/'): continue destination = '%s/%s' % (bucket_name, obj.key) if not os.path.exists(destination): os.makedirs(os.path.dirname(destination), exist_ok=True) bucket.download_file(obj.key, destination) I would like to know how to make this asynchronous, if possible. Thank u in advance.