pylibsnmp.helpers
Python module with helper functions used in the project.
Functions
|
Converts octets to bits. |
|
Converts octets to mac address. |
|
Converts bits to Kbits/s, Mbits/s or Gbits/s according to the bits count. |
|
Returns unit type according to the bits count. |
|
Checks the string to be in ip address format. |
|
Checks whether port number argument has an appropriate value. |
Classes
|
Class for creating python alternative to JavaScript setInterval function. |
- class pylibsnmp.helpers.SetInterval(func: Callable, sec: int)
Class for creating python alternative to JavaScript setInterval function.
- __init__(func: Callable, sec: int) None
Class constructor.
- params:
- func: {Callable} - function to executesec: {int} - interval in seconds to execute func
- cancel()
Cancels Timer object in order for the application to end correctly.
- pylibsnmp.helpers.get_bits(octets: int) int
Converts octets to bits.
An octet is really just a fancy name for a “byte”. So if you multiply this number by 8 you get bits.
- pylibsnmp.helpers.get_mac_from_octets(octets: str, delimiter: str = ':') str
Converts octets to mac address.
When requesting physical address of the device using snmp responce comes in the format of octets.
In order to convert it to mac address: | - get list of ascii codes of octets | - convert it to bytearray | - convert it to hex format
- pylibsnmp.helpers.get_speed(bits: int) int
Converts bits to Kbits/s, Mbits/s or Gbits/s according to the bits count.