Connection

Connection Module

class python_webdav.connection.Client

This class is for interacting with webdav. Its main purpose is to be used by the client.py module but may also be used by developers who wish to use more direct webdav access.

copy_resource(connection, resource_path, resource_destination)

Copy a resource from point a to point b on the server

Parameters:
  • connection (Connection) – Connection object
  • resource_path (String) – Path to the required resource
  • resource_destination (String) – Destination of the copied resource
delete_resource(connection, resource_uri)

Delete resource

Parameters:
  • connection – Connection object
  • resource_uri (String) – URI of the resource
get_file(connection, resource_uri, local_file_name, extra_headers={})

Download file

Parameters:
  • connection (Connection) – Connection object
  • resource_uri (String) – the path of the resource / collection minus the host section
  • local_file_name (String) – Local file where the resource will be saved
  • extra_headers (Dict) – Add any extra headers for the request here
get_lock(resource_uri, connection)

Get a file lock

Parameters:
  • resource_uri (String) – the path of the resource / collection minus the host section
  • connection (Connection) – Connection object
get_properties(connection, resource_uri, properties=[])

Get a list of property objects

Parameters:
  • connection (Connection) – Connection Object
  • resource_uri (String) – the path of the resource / collection minus the host section
  • properties (List) – list of property names to get. If left empty, will get all

Returns a list of resource objects.

get_property(connection, resource_uri, property_name)

Get a property object

Parameters:
  • connection (Connection) – Connection object
  • resource_uri (String) – the path of the resource / collection minus the host section
  • property_name (String) – Property name

Returns the property value as a string

release_lock(resource_uri, connection)

Release a file lock

Parameters:
  • resource_uri (String) – the path of the resource / collection minus the host section
  • connection – Connection object
send_file(connection, resource_uri, local_file_path, extra_headers={})

Send file

Parameters:
  • connection (Connection) – Connection object
  • resource_uri (String) – the path of the resource / collection minus the host section
  • local_file_path (String) – the path of the local file
  • extra_headers (Dict) – Additional headers may be added here
TODO: Allow the file to be read in smaller blocks and sent using
the content range header (if available)
class python_webdav.connection.Connection(settings)

Connection object

send_copy(path, destination)

Send a COPY request

Parameters:
  • path (String) – Path (without host) to the source resource to copy
  • destination (String) – Path (without host) to the destination of the copied resource
send_delete(path)

Send a DELETE request

Parameter:path (String) – The path (without host) to the resource to delete
send_get(path, headers={}, callback=False)

Send a GET request NOTE: callback is not yet implimented. It’s purpose is to allow the user to specify a callback so that when x percent of the file has been retrieved, the callback will be executed. This makes allowances for users who may require a progress to be kept track of.

Parameters:
  • path (String) – The path (without host) to the resource to get
  • headers (Dict) – Additional headers for the request should be added here
  • callback (Method or Function) – Not yet implimented. This will allow a callback to be added to the method. This is for such uses as keeping track ofupload progress.
send_lock(path)

Send a LOCK request

Parameter:path (String) – Path (without host) to the resource to lock
send_mkcol(path)

Send a MKCOL request

Parameter:path (String) – Path (without host) to the desired place of the new collection
send_propfind(path, body='', extra_headers={})

Send a PROPFIND request

Parameters:
  • path (String) – Path (without host) to the resource from which the properties are required
  • body (String) – The body of the request
  • extra_headers (Dict) – Additional headers for the request may be added here
send_put(path, body, headers={})

This PUT request will put data files onto a webdav server. However, please note that due to the way in which httplib2 sends files, it is not currently possible to break a file up into chunks and read it in. In other words, the whole file has to be read into memory for sending. This could be problematic for large files.

Parameters:
  • path (String) – The path (without host) to the desired file destination
  • body (String) – Body of the request. This is the data which to send to the destination file
  • headers (Dict) – Additional headers for the request may be added here
send_rmcol(path)

Send an RMCOL request

Parameter:path (String) – Path (without host) to the collection to remove
send_unlock(path, lock_token)

Send an UNLOCK request

Parameters:
  • path (String) – Path (without host) to the resource to unlock
  • lock_token (LockToken) – LockToken object retrived while locking the resource
class python_webdav.connection.LockToken(lock_token)
LockToken object. This is an object that contains information about a lock on a resource or collection
class python_webdav.connection.Property

Property object for storing information about WebDAV properties

set_property(property_name, property_value=None)

Set property names

Parameters:
  • property_name (String) – Name of the property
  • property_value (String) – Value of the named property

Previous topic

Client

Next topic

Parse

This Page