Package commons :: Module networking
[hide private]
[frames] | no frames]

Module networking

source code

Networking tools.

Classes [hide private]
  no_mac_addr_exception
Functions [hide private]
 
get_mac_addr()
Simply parses the output of ifconfig or ipconfig to estimate this machine's IP address.
source code
 
retry_exp_backoff(initial_backoff, multiplier, func)
Repeatedly invoke func until it succeeds (returns non-None), with exponentially growing backoff delay between each try.
source code
 
logout(*args, **kwds)
A context manager for calling the logout() method of an object.
source code
 
inet_nltoa(x)
Convert an IPv4 address from an int in network byte order to a string.
source code
 
inet_hltoa(x)
Convert an IPv4 address from an int in host byte order to a string.
source code
Variables [hide private]
  __package__ = 'commons'
  accept2dyear = 1
  altzone = 14400
  daylight = 1
  timezone = 18000
  tzname = ('EST', 'EDT')
Function Details [hide private]

get_mac_addr()

source code 

Simply parses the output of ifconfig or ipconfig to estimate this machine's IP address. This is not at all reliable, but tends to work "well enough" for my own purposes.

From http://mail.python.org/pipermail/python-list/2005-December/357300.html.

Copyright: Frank Millman

Note that http://libdnet.sf.net/ provides this functionality and much more.

retry_exp_backoff(initial_backoff, multiplier, func)

source code 

Repeatedly invoke func until it succeeds (returns non-None), with exponentially growing backoff delay between each try.

Parameters:
  • initial_backoff (float) - The initial backoff.
  • multiplier (float) - The amount by which the backoff is multiplied on each failure.
  • func (function) - The zero-argument function to be invoked that returns True on success and False on failure.
Returns:
The result of the function

logout(*args, **kwds)

source code 

A context manager for calling the logout() method of an object.

Decorators:
  • @contextmanager