moznetwork — Get network information

moznetwork is a very simple module designed for one task: getting the network address of the current machine.

Example usage:

import moznetwork

try:
    ip = moznetwork.get_ip()
    print "The external IP of your machine is '%s'" % ip
except moznetwork.NetworkError:
    print "Unable to determine IP address of machine"
    raise
moznetwork.get_ip()

Provides an available network interface address, for example “192.168.1.3”.

A NetworkError exception is raised in case of failure.