nis — Interface to Sun’s NIS (Yellow Pages)


Thenis module gives a thin wrapper around the NIS library, useful forcentral administration of several hosts.

Because NIS exists only on Unix systems, this module is only available for Unix.

Thenis module defines the following functions:

nis.match(key,mapname,domain=default_domain)

Return the match forkey in mapmapname, or raise an error(nis.error) if there is none. Both should be strings,key is 8-bitclean. Return value is an arbitrary array of bytes (may containNULL andother joys).

Note thatmapname is first checked if it is an alias to another name.

Thedomain argument allows overriding the NIS domain used for the lookup. Ifunspecified, lookup is in the default NIS domain.

nis.cat(mapname,domain=default_domain)

Return a dictionary mappingkey tovalue such thatmatch(key,mapname)==value. Note that both keys and values of the dictionary arearbitrary arrays of bytes.

Note thatmapname is first checked if it is an alias to another name.

Thedomain argument allows overriding the NIS domain used for the lookup. Ifunspecified, lookup is in the default NIS domain.

nis.maps(domain=default_domain)

Return a list of all valid maps.

Thedomain argument allows overriding the NIS domain used for the lookup. Ifunspecified, lookup is in the default NIS domain.

nis.get_default_domain()

Return the system default NIS domain.

Thenis module defines the following exception:

exceptionnis.error

An error raised when a NIS function returns an error code.