lua-requests icon indicating copy to clipboard operation
lua-requests copied to clipboard

Feature request: posting multipart-encoded files with requests.post

Open hishamhm opened this issue 8 years ago • 1 comments

In Python requests we can pass a files= argument and send files in POST request:

http://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file

This is needed by lua-mastodon to send messages to the network with file attachments:

https://github.com/hishamhm/lua-mastodon/blob/master/mastodon.lua#L342

I already wrote the code using the files argument, since I assumed lua-requests supported it already, so for now that field is a no-op, but it's ready if the feature comes in the future. :)

Thank you for such a great library! I wouldn't have written lua-mastodon without it!

hishamhm avatar Apr 14 '17 21:04 hishamhm

Oh, btw, just remembered there's some code for multipart-encoding inside LuaRocks that may be useful!

https://github.com/luarocks/luarocks/blob/master/src/luarocks/upload/multipart.lua

Feel free to get as much as you want from it. :)

hishamhm avatar Apr 14 '17 22:04 hishamhm