Package: webdavclient
webdavclientPackage webdavclient provides easy and convenient work with
WebDAV-servers (Yandex.Drive, Dropbox, Google Drive, Box, 4shared,
etc.). The package includes the following components: webdav API,
resource API and wdc.The source code of the project can be foundhereInstallation and upgradeInstallationLinux$sudoapt-getinstalllibxml2-devlibxslt-devpython-dev$sudoapt-getinstalllibcurl4-openssl-devpython-pycurl$sudoeasy_installwebdavclientmacOScurlhttps://bootstrap.pypa.io/ez_setup.py-o-|pythonpythonsetup.pyinstall--prefix=/opt/setuptoolssudoeasy_installwebdavclientUpdate$sudopipinstall-UwebdavclientWebdav APIWebdav API is a set of webdav methods of work with cloud storage. This
set includes the following methods:check,free,info,list,mkdir,clean,copy,move,download,upload,publishandunpublish.Configuring the clientRequired keys for configuring client connection with WevDAV-server are
webdav_hostname and webdav_login, webdav,_password.importwebdav.clientaswcoptions={'webdav_hostname':"https://webdav.server.ru",'webdav_login':"login",'webdav_password':"password"}client=wc.Client(options)When a proxy server you need to specify settings to connect through it.importwebdav.clientaswcoptions={'webdav_hostname':"https://webdav.server.ru",'webdav_login':"w_login",'webdav_password':"w_password",'proxy_hostname':"http://127.0.0.1:8080",'proxy_login':"p_login",'proxy_password':"p_password"}client=wc.Client(options)If you want to use the certificate path to certificate and private key
is defined as follows:importwebdav.clientaswcoptions={'webdav_hostname':"https://webdav.server.ru",'webdav_login':"w_login",'webdav_password':"w_password",'cert_path':"/etc/ssl/certs/certificate.crt",'key_path':"/etc/ssl/private/certificate.key"}client=wc.Client(options)Or you want to limit the speed or turn on verbose mode:options={...'recv_speed':3000000,'send_speed':3000000,'verbose':True}client=wc.Client(options)recv_speed: rate limit data download speed in Bytes per second.
Defaults to unlimited speed.send_speed: rate limit data upload speed in Bytes per second.
Defaults to unlimited speed.verbose: set verbose mode on/off. By default verbose mode is off.Synchronous methods//Checkingexistenceoftheresourceclient.check("dir1/file1")client.check("dir1")//Getinformationabouttheresourceclient.info("dir1/file1")client.info("dir1/")//Checkfreespacefree_size=client.free()//Getalistofresourcesfiles1=client.list()files2=client.list("dir1")//Createdirectoryclient.mkdir("dir1/dir2")//Deleteresourceclient.clean("dir1/dir2")//Copyresourceclient.copy(remote_path_from="dir1/file1",remote_path_to="dir2/file1")client.copy(remote_path_from="dir2",remote_path_to="dir3")//Moveresourceclient.move(remote_path_from="dir1/file1",remote_path_to="dir2/file1")client.move(remote_path_from="dir2",remote_path_to="dir3")//Moveresourceclient.download_sync(remote_path="dir1/file1",local_path="~/Downloads/file1")client.download_sync(remote_path="dir1/dir2/",local_path="~/Downloads/dir2/")//Unloadresourceclient.upload_sync(remote_path="dir1/file1",local_path="~/Documents/file1")client.upload_sync(remote_path="dir1/dir2/",local_path="~/Documents/dir2/")//Publishtheresourcelink=client.publish("dir1/file1")link=client.publish("dir2")//Unpublishresourceclient.unpublish("dir1/file1")client.unpublish("dir2")//Exceptionhandlingfromwebdav.clientimportWebDavExceptiontry:...exceptWebDavExceptionasexception:...//Getthemissingfilesclient.pull(remote_directory='dir1',local_directory='~/Documents/dir1')//Sendmissingfilesclient.push(remote_directory='dir1',local_directory='~/Documents/dir1')Asynchronous methods//Loadresourcekwargs={'remote_path':"dir1/file1",'local_path':"~/Downloads/file1",'callback':callback}client.download_async(**kwargs)kwargs={'remote_path':"dir1/dir2/",'local_path':"~/Downloads/dir2/",'callback':callback}client.download_async(**kwargs)//Unloadresourcekwargs={'remote_path':"dir1/file1",'local_path':"~/Downloads/file1",'callback':callback}client.upload_async(**kwargs)kwargs={'remote_path':"dir1/dir2/",'local_path':"~/Downloads/dir2/",'callback':callback}client.upload_async(**kwargs)Resource APIResource API using the concept of OOP that enables cloud-level
resources.//Getaresourceres1=client.resource("dir1/file1")//Workwiththeresourceres1.rename("file2")res1.move("dir1/file2")res1.copy("dir2/file1")info=res1.info()res1.read_from(buffer)res1.read(local_path="~/Documents/file1")res1.read_async(local_path="~/Documents/file1",callback)res1.write_to(buffer)res1.write(local_path="~/Downloads/file1")res1.write_async(local_path="~/Downloads/file1",callback)wdcwdc -a cross-platform utility that provides convenient work with
WebDAV-servers right from your console. In addition to full
implementations of methods from webdav API, also added methods content
sync local and remote directories.AuthenticationBasic authentication$wdcloginhttps://wedbav.server.ru-phttp://127.0.0.1:8080webdav_login:w_loginwebdav_password:w_passwordproxy_login:p_loginproxy_password:p_passwordsuccessAuthorize the application using OAuth token*$wdcloginhttps://wedbav.server.ru-phttp://127.0.0.1:8080--tokenxxxxxxxxxxxxxxxxxxproxy_login:p_loginproxy_password:p_passwordsuccessThere are also additional keys--root[-r],--cert-path[-c]and--key-path[-k].Utility$wdcchecksuccess$wdccheckfile1notsuccess$wdcfree245234120344$wdclsdir1file1...fileN$wdcmkdirdir2$wdccopydir1/file1-tdir2/file1$wdcmovedir2/file1-tdir2/file2$wdcdownloaddir1/file1-t~/Downloads/file1$wdcdownloaddir1/-t~/Downloads/dir1/$wdcuploaddir2/file2-f~/Documents/file1$wdcuploaddir2/-f~/Documents/$wdcpublishdi2/file2https://yadi.sk/i/vWtTUcBucAc6k$wdcunpublishdir2/file2$wdcpulldir1/-t~/Documents/dir1/$wdcpushdir1/-f~/Documents/dir1/$wdcinfodir1/file1{'name':'file1','modified':'Thu, 23 Oct 2014 16:16:37 GMT','size':'3460064','created':'2014-10-23T16:16:37Z'}WebDAV-serverThe most popular cloud-based repositories that support the Protocol
WebDAV can be attributed Yandex.Drive, Dropbox, Google Drive, Box and
4shared. Access to data repositories, operating with access to the
Internet. If necessary local locations and cloud storage, you can deploy
your own WebDAV-server.Local WebDAV-serverTo deploy a local WebDAV server, using Docker containers quite easily
and quickly. To see an example of a local deploymentWebDAV servers can
be on the projectwebdav-server-docker.Supported methodsServersfreeinfolistmkdircleancopymovedownloaduploadYandex.Disk+++++++++Dropbox-++++++++Google Drive-++++--++Box+++++++++4shared-++++--++Webdavserver-++++--++Publish and unpublish methods supports only Yandex.Disk.Configuring connectionsTo work with cloud storage Dropbox and Google Drive via the WebDAV
Protocol, you must use a WebDAV-server DropDAV and DAV-pocket,
respectively.A list of settings for WebDAV servers:webdav-servers:-yandexhostname:https://webdav.yandex.rulogin:#login_for_yandexpassword:#pass_for_yandex-dropboxhostname:https://dav.dropdav.comlogin:#login_for dropdavpassword:#pass_for_dropdav-googlehostname:https://dav-pocket.appspot.comroot:docsologin:#login_for_dav-pocketpassword:#pass_for_dav-pocket-boxhostname:https://dav.box.comroot:davlogin:#login_for_boxpassword:#pass_for_box-4sharedhostname:https://webdav.4shared.comlogin:#login_for_4sharedpassword:#pass_for_4sharedAutocompletionFor macOS, or older Unix systems you need to update bash.brewinstallbashchshbrewinstallbash-completionAutocompletion can be enabled globallysudoactivate-global-python-argcompleteor locally#.bashrceval"$(register-python-argcompletewdc)"