how to upload image through python-eve to some external storage server e.g. S3? how to upload image through python-eve to some external storage server e.g. S3? flask flask

how to upload image through python-eve to some external storage server e.g. S3?


While the standard behaviour is to store on GridFS, you can also provide your own MediaStorage subclass which can store wherever you want to (file system, S3, etc.)

Something like this would do the trick:

from eve.io.media import MediaStorageclass AmazonS3MediaStorage(MediaStorage):    """ Your actual implementation """    passapp = Eve(media=AmazonS3MediaStorage)if __name__ == '__main__':    app.run()

Check out the actual MediaStorage class for implementation details and/or see the actual GridFSMediaStorage class for reference.