Package entropy :: Package transceivers :: Package uri_handlers :: Module skel :: Class EntropyUriHandler

Class EntropyUriHandler

source code


Instance Methods
 
__init__(self, uri)
EntropyUriHandler constructor.
source code
 
__enter__(self)
Support for "with" statement, this will trigger UriHandler connection setup.
source code
 
__exit__(self, exc_type, exc_value, traceback)
Support for "with" statement, this will trigger UriHandler connection hang up.
source code
string
get_uri(self)
Return copy of previously stored URI.
source code
 
set_output_interface(self, output_interface)
Provide alternative Entropy output interface (must be based on entropy.output.TextInterface)
source code
 
set_speed_limit(self, speed_limit)
Set download/upload speed limit in kb/sec form.
source code
 
set_timeout(self, timeout)
Set transceiver tx/rx timeout value in seconds.
source code
 
set_silent(self, silent)
Disable transceiver verbosity.
source code
 
set_verbosity(self, verbosity)
Set transceiver verbosity.
source code
bool
download(self, remote_path, save_path)
Download URI and save it to save_path.
source code
bool
upload(self, load_path, remote_path)
Upload URI from load_path location to uri.
source code
bool
rename(self, remote_path_old, remote_path_new)
Rename URI old to URI new.
source code
bool
delete(self, remote_path)
Remove the remote path (must be a file).
source code
string or None (if not supported)
get_md5(self, remote_path)
Return MD5 checksum of file at URI.
source code
list
list_content(self, remote_path)
List content of directory referenced at URI.
source code
list
list_content_metadata(self, remote_path)
List content of directory referenced at URI with metadata in this form: [(name, size, owner, group, permissions<drwxr-xr-x>,), ...] permissions, owner, group, size, name.
source code
bool
is_path_available(self, remote_path)
Given a remote path (which can point to dir or file), determine whether it's available or not.
source code
bool
is_dir(self, remote_path)
Given a remote path (which can point to dir or file), determine whether it's a directory.
source code
bool
is_file(self, remote_path)
Given a remote path (which can point to dir or file), determine whether it's a file.
source code
 
makedirs(self, remote_path)
Given a remote path, recursively create all the missing directories.
source code
 
keep_alive(self)
Send a keep-alive ping to handler.
source code
 
close(self)
Called when requesting to close connection completely.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from output.TextInterface: askQuestion, cycleDone, inputBox, nocolor, notitles, setTitle, setTotalCycles, updateProgress

Static Methods
bool
approve_uri(uri)
Approve given URI by returning True or False depending if this class is able to handle it.
source code
string
get_uri_name(uri)
Given a valid URI (meaning that implementation can handle the provided URI), it extracts and returns the URI name (hostname).
source code
string
hide_sensible_data(uri)
Given an URI, hide sensible data from string and return it back.
source code
Class Variables
  BASE_PLUGIN_API_VERSION = 0
Base class for EntropyTransceiver URI handler interfaces.
Properties

Inherited from object: __class__

Method Details

__init__(self, uri)
(Constructor)

source code 

EntropyUriHandler constructor. When constructor is called, instance should perform a connection and permissions check and raise entropy.exceptions.ConnectionError in case of issues.

Parameters:
  • uri (string) - URI to handle
Overrides: object.__init__

approve_uri(uri)
Static Method

source code 

Approve given URI by returning True or False depending if this class is able to handle it.

Parameters:
  • uri (string) - URI to handle
Returns: bool
True, if URI can be handled by this class

get_uri_name(uri)
Static Method

source code 

Given a valid URI (meaning that implementation can handle the provided URI), it extracts and returns the URI name (hostname).

Parameters:
  • uri (string) - URI to handle
Returns: string
URI name

hide_sensible_data(uri)
Static Method

source code 

Given an URI, hide sensible data from string and return it back.

Parameters:
  • uri (string) - URI to handle
Returns: string
URI cleaned

get_uri(self)

source code 

Return copy of previously stored URI.

Returns: string
stored URI

set_output_interface(self, output_interface)

source code 

Provide alternative Entropy output interface (must be based on entropy.output.TextInterface)

Parameters:
  • output_interface (entropy.output.TextInterface based instance) - new entropy.output.TextInterface instance to use
Raises:
  • AttributeError - if argument passed is not correct

set_speed_limit(self, speed_limit)

source code 

Set download/upload speed limit in kb/sec form.

Parameters:
  • speed_limit (int) - speed limit in kb/sec form.

set_timeout(self, timeout)

source code 

Set transceiver tx/rx timeout value in seconds.

Parameters:
  • timeout (int) - timeout in seconds

set_silent(self, silent)

source code 

Disable transceiver verbosity.

Parameters:
  • verbosity (bool) - verbosity value

set_verbosity(self, verbosity)

source code 

Set transceiver verbosity.

Parameters:
  • verbosity (bool) - verbosity value

download(self, remote_path, save_path)

source code 

Download URI and save it to save_path.

Parameters:
  • remote_path (string) - remote path to handle
  • save_path (string) - complete path where to store file from uri. If directory doesn't exist, it will be created with default Entropy permissions.
Returns: bool
execution status, True if done
Raises:

upload(self, load_path, remote_path)

source code 

Upload URI from load_path location to uri.

Parameters:
  • load_path (string) - remote path to handle
  • remote_path (string) - remote path to handle ("directory"/"file name" !)
Returns: bool
execution status, True if done
Raises:

rename(self, remote_path_old, remote_path_new)

source code 

Rename URI old to URI new.

Parameters:
  • remote_path_old (string) - remote path to handle
  • remote_path_new (string) - remote path to create
Returns: bool
execution status, True if done
Raises:

delete(self, remote_path)

source code 

Remove the remote path (must be a file).

Parameters:
  • remote_path_old (string) - remote path to remove (only file allowed)
Returns: bool
True, if operation went successful
Raises:

get_md5(self, remote_path)

source code 

Return MD5 checksum of file at URI.

Parameters:
  • remote_path (string) - remote path to handle
Returns: string or None (if not supported)
MD5 checksum in hexdigest form

list_content(self, remote_path)

source code 

List content of directory referenced at URI.

Parameters:
  • remote_path (string) - remote path to handle
Returns: list
content
Raises:
  • ValueError - if remote_path does not exist

list_content_metadata(self, remote_path)

source code 

List content of directory referenced at URI with metadata in this form: [(name, size, owner, group, permissions<drwxr-xr-x>,), ...] permissions, owner, group, size, name.

Parameters:
  • remote_path (string) - remote path to handle
Returns: list
content
Raises:
  • ValueError - if remote_path does not exist

is_path_available(self, remote_path)

source code 

Given a remote path (which can point to dir or file), determine whether it's available or not.

Parameters:
  • remote_path (string) - URI to handle
Returns: bool
availability

is_dir(self, remote_path)

source code 

Given a remote path (which can point to dir or file), determine whether it's a directory.

Parameters:
  • remote_path (string) - URI to handle
Returns: bool
True, if remote_path is a directory

is_file(self, remote_path)

source code 

Given a remote path (which can point to dir or file), determine whether it's a file.

Parameters:
  • remote_path (string) - URI to handle
Returns: bool
True, if remote_path is a file

makedirs(self, remote_path)

source code 

Given a remote path, recursively create all the missing directories.

Parameters:
  • remote_path (string) - URI to handle

keep_alive(self)

source code 

Send a keep-alive ping to handler.

Raises:

Class Variable Details

BASE_PLUGIN_API_VERSION

Base class for EntropyTransceiver URI handler interfaces. This provides a common API for implementing custom URI handlers.

To add your URI handler to EntropyTransceiver, do the following: >>> EntropyTransceiver.add_uri_handler(my_entropy_transceiver_based_instance) "add_uri_handler" is a EntropyTransceiver static method.

Value:
0