python - How to upload a file to Hug REST API -
i'm working on basic hug api , 1 of functions needs file.
does hug have way upload file?
this example you're looking for: https://github.com/timothycrosley/hug/blob/develop/examples/file_upload_example.py
@hug.post('/upload') def upload_file(body): """accepts file uploads""" # simple dictionary of {filename: b'content'} print('body: ', body) return {'filename': list(body.keys()).pop(), 'filesize': len(list(body.values()).pop())}
Comments
Post a Comment