Ian Underwood Python kit
Project description
iupy
Ian Underwood Python Kit (IUPY)
About
This package is a set of Python functions that I have built out and found useful in my travels as a network engineer. This is the base package for all iupy additional packages to follow.
This functions in this package are meant to be standalone packages and have no other package dependencies beyond a base Python installation. These functions are designed to be light on requirements.
This package has been built and tested against Python 3.9, and should work down to 3.7 but I can't guarantee that.
Function Summary
misc.py
iupy.text_header : Returns a text header returning the time, user, and system a given output was generated on. Additional options allow for identifying a source, as well as another user if specified. A footer may also be defined.
iupy.merge_dict : Returns a combined dictionary given two dictionary inputs.
myconfig.py
iupy.get_file_handle_ro : Returns a file handle given a name, or None if the file cannot be found or is inaccessible. Exceptions are logged to DEBUG.
iupy.get_my_config : Moves through a series of directories looking for a configuration file needed by a script. This returns a data dictionary containing the data, the filename used, and the file's timestamp. Useful for baking portable CLI utilities and automated scripts.
network.py
Host Information
iupy.get_my_ip : Returns a string, the source IP given a remote IP address or destination. Returns None if there is a SocketError which prevents the source from being determined. If no destination is specified, the function assumes well-known DNS server 4.2.2.1
ACL and Bitmask Tools
iupy.v4_bits_to_mask : Returns a string, a netmask based upon the number of bits in relation to 0.0.0.0/bits. Returns None if the mask is out of range.
ippy.v4_mask_to_bits : Returns a string, as the largest number of consecutive bits given an IP address. This is far more forgiving than the ipaddress library, which may be useful to some.
iupy.v4_wildcard : This function returns a compliant wildcard for a given IP address. This is similar to, but different than a host mask as a wildcard does not need to have a series of consecutive bits in order to be valid.
iupy.aclv4_hostmask : Takes an IPv4 host or host/mask and returns a Cisco-compatible string for use in ACL generation.
iupy.routev4_hostmask : Takes an IPv4 host or host/mask and returns a cisco-compatible string for use in generating static route statements.
Session Announcement Protocol
iupy.sap_segment : This function generates the segment portion of an RFC-2974 Session Announcement Protocol packet. The segment still needs to but put on the wire with a UDP socket. The keywords cover the fields the segment requires. Returns None if any of the keywords are invalid or incomplete.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file iupy-0.2.1.tar.gz
.
File metadata
- Download URL: iupy-0.2.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12ffc7eef49578d52ca1ff976e576a5c9397a25675b2cac8ee98bb08e2ff3010 |
|
MD5 | 5dd81ca7de044ca74424125e74044e41 |
|
BLAKE2b-256 | f4893d526e8ca1722a90a81bebcc4939b9ab3911e3338945f5bc45a9d0b9981b |
File details
Details for the file iupy-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: iupy-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c94c2cf5f5d601d9060609c8de9e0c8f45936f771cac2f363bead784f99d53 |
|
MD5 | f73712051cebda0c7d568e2baa950a3b |
|
BLAKE2b-256 | 6a353fdb4872b9b95f3339c23eca2f662fada94c34c4ad23d60267b4ca2099dc |