Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Inetsix tools library

Project description

Inetsix Python toolbox

Build Status Documentation Status PyPI version

This module provides some generic python functions usually used in many of scripts. Instead of rewriting these functions in all scripts, we have put them in a single module.

Current classes:

  • ExcelSerializer from inetsix.excel: Class to serialize excel spreadsheet into Python structure to be consume in scripts or templates
  • InetsixTools from Use @classmethod to provide some generic functions
    • PPRINT rendering
    • List of files in a given directory
    • Get basname of a complete path to a file
    • Extract a list() of unique values in a list()
    • Convert a dict() to a list()
    • Download file with HTTP/HTTPS transport
    • Set variable from user environment


$ pip install inetsix

Quick Start

Generic tools Functions usage

This example shows you how to use some functions:

import os
import logging

STRUCTURE_JPRINT='{"access":10,"configured":true,"hostname":"leaf1-demo","mode":"switch","description":"Access interface","name":"ethernet 1"}'

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)'Starting test with version: '+inetsix.version)

    # Print a JSON structure
    # without initiate a pprint configuration'Validate inetsix.jprint with JSON string')

    # List all file with `whl` extension in a given directory
    # Result is a list of filenames'Validation inetsix.get_list_files')
    print, extension='whl')

    # Download a file from an HTTPS server
    # and save it in the current directory'Test download validation with HTTPS')
    result ='Downloaded file %s', result)
    logging.warning('remove downloaded file')
    os.remove(result)'End process validation')

it can also be used with following syntax:

from import InetsixTools

STRUCTURE_JPRINT='{"access":10,"configured":true,"hostname":"leaf1-demo","mode":"switch","description":"Access interface","name":"ethernet 1"}'

result = InetsixTools.download_file(remote_file=URI_DOWNLOAD)

As code was built with come generic function directly on top of the library, those ones will remains for legacy but not maintained anymore

Class use case:

import inetsix
import logging
from inetsix.excel import ExcelSerializer

EXCELFILENAME = '.ci/excel-demo.xlsx'

if __name__ == '__main__':

    myExcel = ExcelSerializer(excel_path=EXCELFILENAME)
    myExcel.serialize_table(sheet="test", nb_columns=3)


Output example:

[   {   u'address': '', u'id': '1', u'name': 'eh0'},
    {   u'address': '', u'id': '2', u'name': 'eth1'},
    {   u'address': '', u'id': '3', u'name': 'eth2'}]

Get code documentation

To get code documentation, use command:

$ python

>>> import inetsix
>>> help(inetsix)

>>> from inetsix.excel import ExcelSerializer
>>> help(ExcelSerializer)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
inetsix-0.0.4.tar.gz (11.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page