Skip to content

Instantly share code, notes, and snippets.

@Vostbur
Created February 10, 2015 14:26
Show Gist options
  • Save Vostbur/ffed19f198455ed3bed8 to your computer and use it in GitHub Desktop.
Save Vostbur/ffed19f198455ed3bed8 to your computer and use it in GitHub Desktop.
Upload file to WebDAV with Digest authentication and HTTP PUT
import requests
from requests.auth import HTTPDigestAuth
import sys
if __name__ == '__main__':
fname = sys.argv[0]
with open(fname) as f:
payload = f.read()
url = 'http://servername.org/webdav/'
r = requests.put(url+fname, data=payload, auth=HTTPDigestAuth('user', 'passwd'))
print(r.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment