simplewebdavclient package

Submodules

simplewebdavclient.checkers module

simplewebdavclient.checkers.check_number(number)[source]

Function to verify item entered is a number

Parameters:number (Integer) – Thing to check for a number
Return type:None
Returns:None
Raises:NotNumber – If number is not a number
simplewebdavclient.checkers.check_tcp_udp_port_number(port_number)[source]

Function to verify a tcp or udp port number 1 to 65535

Parameters:port_number (Integer) – TCP/UDP Port Number
Return type:None
Returns:None
Raises:BadPortNumber – If the port is not in range 1 to 65535

simplewebdavclient.exceptions module

exception simplewebdavclient.exceptions.BadPortNumber(value)[source]

Bases: Exception

exception simplewebdavclient.exceptions.CouldNotDetermineProtocol(value)[source]

Bases: Exception

exception simplewebdavclient.exceptions.NotNumber(value)[source]

Bases: Exception

exception simplewebdavclient.exceptions.OperationFailed(method, path, expected_code, actual_code)[source]

Bases: Exception

simplewebdavclient.simplewebdavclient module

class simplewebdavclient.simplewebdavclient.Client(host, port=None, auth=None, username=None, password=None, protocol='http', verify_ssl=True, path=None, cert=None)[source]

Bases: object

Class for WebDav Client

Parameters:
  • host (String) – IP of the server
  • port (Integer) – The TCT/UDP Port Number
  • auth (String) – Session auth
  • username (String) – Username
  • password (String) – Password
  • protocol (String) – http, or https
  • verify_ssl (Boolean) – True or False
  • path (String) – The path to the resource
  • cert (String) – Session cert
Raises:

CouldNotDetermineProtocol – If protocol is not http or https

change_current_working_directory(path)[source]

Method to change your current working directory

Parameters:path (String) – Path from your root
Return type:None
Returns:None
directories_create(path)[source]

Method to create nested directories

Parameters:path (String) – Path from your root
Return type:None
Returns:None
directory_create(path, safe=False)[source]

Method to make a directory

Parameters:
  • path (String) – Path from your root
  • safe (Boolean) – If set to True it will silently do nothing is if directory already exists
Return type:

None

Returns:

None

directory_delete(path, safe=False)[source]

Method to delete a directory

Parameters:
  • path (String) – Path from your root
  • safe (Boolean) – If set to True it will silently do nothing is if directory already exists
Return type:

None

Returns:

None

download(remote_path, local_path_or_fileobj)[source]

Method to download files from WebDav server

Parameters:
  • remote_path (String) – The path
  • local_path_or_fileobj (String) – The path
Return type:

None

Returns:

None

get_base_url()[source]

Method to get base url

Return type:String
Returns:The base url
get_current_working_directory()[source]

Method to get current working directory

Return type:String
Returns:The current working directory
static get_xml_element(element, element_name, default=None)[source]

Method to retrieve the data from the xml tree

Parameters:
  • element (String) – The xml element
  • element_name (String) – The property
  • default (String) – What to set default to
Return type:

String

Returns:

A String

resource_delete(path)[source]

Mwethod to delete a resource

Parameters:path (String) – Path from your root
Return type:None
Returns:None
resource_exists(remote_path)[source]

Method to verify if a resource exists on the WebDav server

Parameters:remote_path (String) – The path
Return type:Boolean
Returns:True or False
resource_list(remote_path='.')[source]

Method to list resources on the WebDav server

Parameters:remote_path (String) – The path
Type:List
Returns:A list of FileData objects
upload(local_path_or_fileobj, remote_path)[source]

Method to upload files to WebDav Server

Parameters:
  • local_path_or_fileobj (String) – The path
  • remote_path (String) – The path
Return type:

None

Returns:

None

class simplewebdavclient.simplewebdavclient.FileData(resource_url, resource_name, file_size, modified_time, creation_time, content_type)[source]

Bases: object

Class to store a file info

Parameters:
  • resource_url (String) – The resource URL
  • resource_name (String) – The name of the resource
  • file_size (String) – The file size
  • modified_time (String) – The modified date/time
  • creation_time (String) – The creation date/time
  • content_type (String) – The content type
get_content_type()[source]

Method to get the WebDav resource content type

Return type:String
Returns:A resource content type
get_creation_time()[source]

Method to get the WebDav resource creation date and time

Return type:String
Returns:A resource creation date and time
get_file_size()[source]

Method to get the WebDav resource file size

Return type:String
Returns:A resource file size
get_modified_time()[source]

Method to get the WebDav resource modified date and time

Return type:String
Returns:A resource modified date and time
get_resource_name()[source]

Method to get the WebDav resource name

Return type:String
Returns:A resource name
get_resource_url()[source]

Method to get the WebDav resource url

Return type:String
Returns:A resource url
is_dir()[source]

Method to check to see if WebDav resource is a directory

Return type:Boolean
Returns:True or False

Module contents