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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -