Welcome to tekuila’s documentation!

This is a simple Python library for parsing your ISPs download limits API.

Contents:

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.

Supported ISPs

All ISP implementations inherit from the base Tekuila class.

TekSavvy

TekSavvy

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

Bases: tekuila.tekuila.Tekuila

Parse implementation for TekSavvy API

fetch_data()[source]

Pull JSON data from TekSavvy api url using API key pulled from config file set by user.

print_data(verbose=False)[source]

Prints the data pulled from the JSON results. Can be forced or defaulted to print if verbose is set in __init__

Parameters:verbose – Print details.

Start.ca

Start.ca

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

Bases: tekuila.tekuila.Tekuila

Fetch and parse Start.ca quota API

static b_to_GB(value)[source]

Convert from bytes to GB.

Parameters:value – The value in bytes to convert to GB.
Returns:Converted GB value
fetch_data()[source]

Pull XML data from Start.ca API url using API key. Store it within the class for processing.

print_data(verbose=False)[source]

Prints the data pulled from the JSON results. Can be forced or defaulted to print if verbose is set in __init__

Parameters:verbose – Print details.

Contributing

PRs and issues welcome.

Tests

In your virutalenv install tox:

pip install tox

Run the tests:

tox

Please write tests for new functionality.

Indices and tables