Shared (nornir_shared)

Nornir Shared Package

Functions shared across the various Nornir and connectomics packages live in this module.

checksum

nornir_shared.checksum.DataChecksum(data)
Removes whitespace from strings before calculating md5 checksum
Parameters:data (obj) – string, list or object convertible to string
Returns:md5 checksum
Rtype str:
nornir_shared.checksum.FileChecksum(filename)

Return the md5 hash of a file read in txt mode

Parameters:filename (str) – path to file
Returns:md5 checksum
Rtype str:
nornir_shared.checksum.FilesizeChecksum(filename)

Returns the size of a file in bytes for use as a simple checksum

Parameters:filename (str) – path to file
Returns:Size of file as a string
Return type:str

emaillib

nornir_shared.emaillib.SendMail(**kwargs)

Sends an email

Parameters:
  • host (str) – Address of smpt server
  • username (str) – username for smtp account if required
  • password (str) – password for smtp account if required
  • subject (str) – subject for E-mail
  • message (str) – text content of message
  • to (str) – Recipient addresses as string or list of strings
  • cc (str) – Recipient addresses as string or list of strings
  • from (str) – Sender’s E-mail address
  • fromFriendlyAddress (str) – Nice looking Sender’s E-mail address
  • files (list) – comma delimited list of files to attach
  • port (int) – port to use on server, default is 25