Upload a file via WebDav

Hi guys,

does anyone know a way to upload a file to a WebDav location in a test case or keyword?

Did a quick read about this, seems all you need to do is a HTTP PUT to the path where you want to put the file, the PUT body should be the file, you may also need to include the file type in the Content-Type header.

PUT On Session "data can be a dictionary, list of tuples, bytes, or file-like object. If you want to pass a json body pass a dictionary as json parameter."

Even though this is for curl, this is useful reference for what commands do what in webdav https://www.qed42.com/blog/using-curl-commands-webdav you just need to translate them to requests calls.

Hope that helps,

Dave.

Thanks for pointing me into right direction. I’ll try this.

I just want to add another option. Specially if you do not want to setup the requests manually.

I have been using a small CLI tool called davix.

Basically you just assemble the string witht he command line and pass it as the parameter to the Run key-work from the Operating System library.

I like to use it because it allows multi-threaded upload, which helps a lot if you have to move a lot of file (in my case invoices and events ICS files for processing).

More about the tool: