Hi, I am developing my first HttpApi plugin and struggling with file upload. I am getting an error:
ansible/module_utils/connection.py", line 149, in _exec_jsonrpc raise ConnectionError( fatal: [device_1]: FAILED! => { "changed": false, "invocation": { "module_args": { "filename": "file.bin", "state": "present" } }, "msg": "Connection error occurred: Failed to encode some variables as JSON for communication with ansible-connection. The original exception was: Object of type BufferedReader is not JSON serializable" } The way I provide a file to my request is by file-like object - open() in "rb" mode I've also tried reading the file-like object and providing it this way None of these approaches work I was able to get it working using requests library with: response = session.put(url, data=open("file.bin", "rb"), headers={"Content-Type": "application/octet-stream"}) Is is possible to upload a file using custom HttpApi plugin? If so how do I provide the file to a request? If any additional info is needed, let me know Code snippet <https://gist.github.com/Soothly/c7dba5e626fd4f1b6b172940ea6ce9a6> Best Regards Piotr Gabryś -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/ba870aa3-0530-4dcb-a482-3c81949960ben%40googlegroups.com.