35.12. nis — 接口到 Sun 的 NIS (黄页)


nis module gives a thin wrapper around the NIS library, useful for central administration of several hosts.

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

nis 模块定义了下列函数:

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

Return the match for key in map mapname , or raise an error ( nis.error ) if there is none. Both should be strings, key is 8-bit clean. Return value is an arbitrary array of bytes (may contain NULL and other joys).

注意, mapname is first checked if it is an alias to another name.

domain argument allows overriding the NIS domain used for the lookup. If unspecified, lookup is in the default NIS domain.

nis. cat ( mapname , domain=default_domain )

Return a dictionary mapping key to value 这样 match(key, mapname)==value . Note that both keys and values of the dictionary are arbitrary arrays of bytes.

注意, mapname is first checked if it is an alias to another name.

domain argument allows overriding the NIS domain used for the lookup. If unspecified, lookup is in the default NIS domain.

nis. maps ( domain=default_domain )

Return a list of all valid maps.

domain argument allows overriding the NIS domain used for the lookup. If unspecified, lookup is in the default NIS domain.

nis. get_default_domain ( )

Return the system default NIS domain.

nis 模块定义以下异常:

exception nis. error

引发的错误当 NIS 函数返回错误代码时。

上一话题

35.11. resource — 资源使用信息

下一话题

35.13. syslog — Unix syslog 库例程

本页