Menu

[r8]: / docs / Tutorial.rst  Maximize  Restore  History

Download this file

61 lines (37 with data), 1.6 kB

Tutorial

Introduction

The idea behind the python-webdav library is to provide developers with an easy to use library that can also allow for a finer grain of control when needed.

The library currently contains two modules: connection and client

Connection Module

The connection module itself has four classes: Connection, Client, LockToken and Property

Connection

The Connection class is for setting up a connection object and using it to send HTTP requests to a WebDAV server.

Client

The Client class contains methods for getting and parsing WebDAV responses.

LockToken

Lock tokens are used to aid in basic access control for files contained on a WebDAV server. This is a simple class for containing a lock token as an object.

Property

This class deals with WebDAV properties.

First basic examples

To import the library, use:

import python_webdav

Using the basic functionality of the library is simple. Start by making a Client object:

import python_webdav

client_object = python_webdav.Client('https://webdav.example.net/')
client_object.set_connection(username='KingArthur', password='HolyGrail')

This will set up a Client object that will communicate with the given server and credentials.

The idea of setting up the server and authentication information seperately, is to allow the connection to be used for different users, instead of havingto create individual connections for each user.