Tekuila

This is the base class which all ISP implementations inherit from.

class tekuila.tekuila.Tekuila(apikey=None, cap=None, warn_ratio=None, verbose=False)[source]

Base class for parsing the ISP quota API and act upon the results.

Construct a new fetch/parser to check cap and warn levels.

Parameters:
  • apikey – API key for ISP
  • cap – Your cap in GB
  • warn – The ratio you would like a warning to be returned from check_cap in 0.0 to 1.0 ratio.
  • verbose – Boolean, True to print output.
check_cap(verbose=False)[source]

Check if cap exists, if so check if download total has been exceeded based on fetched results.

Parameters:verbose – Force print and warnings or errors.
Returns:True if exceeded False otherwise.
check_warn(verbose=False)[source]

If cap and warn limit are set, check if the user has passed the set threshold set in the config file.

Parameters:verbose – Force print any warnings or errors.
Returns:True if exceeded, False otherwise.
fetch_data()[source]

Child class must implement. Fetches the data from the ISPs API URI and set’s appropriate values see set_download_data.

load_config(config_path='/home/docs/.tekuila')[source]

Loads in the config file from config path provided, looking for api key, cap limit and warn limit.

Parameters:config_path – Path to config file to parse for API key, warn and cap variables.
print_data(verbose=False)[source]

Child class must implement. Prints the data pulled from the ISP results fetched from the API. Can be forced or defaulted to print if verbose is set in __init__

Parameters:verbose – Print details.