nis
— Interface to Sun’s NIS (Yellow Pages)Sun的NIS接口(黄页)¶
Deprecated since version 3.11: 自3.11版起已弃用:The nis模块已弃用(详见PEP 594)。nis
module is deprecated (see PEP 594 for details).
The nis
module gives a thin wrapper around the NIS library, useful for central administration of several hosts.nis
模块为NIS库提供了一个薄薄的包装器,可用于几个主机的中央管理。
Because NIS exists only on Unix systems, this module is only available for Unix.因为NIS仅存在于Unix系统上,所以此模块仅适用于Unix。
The nis
module defines the following functions:nis
模块定义以下功能:
-
nis.
match
(key, mapname, domain=default_domain)¶ Return the match for key in map mapname, or raise an error (返回map mapname中key的匹配项,如果没有,则引发错误(nis.error
) if there is none.nis.error
)。Both should be strings, key is 8-bit clean.两者都应该是字符串,key是8位干净的。Return value is an arbitrary array of bytes (may contain返回值是任意字节数组(可能包含NULL
and other joys).NULL
和其他值)。Note that mapname is first checked if it is an alias to another name.注意,如果mapname是另一个名称的别名,则首先检查它。The domain argument allows overriding the NIS domain used for the lookup.domain参数允许覆盖用于查找的NIS域。If unspecified, lookup is in the default NIS domain.如果未指定,则在默认NIS域中查找。
-
nis.
cat
(mapname, domain=default_domain)¶ Return a dictionary mapping key to value such that返回字典映射key到value,以匹配match(key, mapname)==value
.match(key, mapname)==value
。Note that both keys and values of the dictionary are arbitrary arrays of bytes.注意,字典的键和值都是字节的任意数组。Note that mapname is first checked if it is an alias to another name.注意,如果mapname是另一个名称的别名,则首先检查它。The domain argument allows overriding the NIS domain used for the lookup.domain参数允许覆盖用于查找的NIS域。If unspecified, lookup is in the default NIS domain.如果未指定,则在默认NIS域中查找。
-
nis.
maps
(domain=default_domain)¶ Return a list of all valid maps.返回所有有效地图的列表。The domain argument allows overriding the NIS domain used for the lookup.domain参数允许覆盖用于查找的NIS域。If unspecified, lookup is in the default NIS domain.如果未指定,则在默认NIS域中查找。
-
nis.
get_default_domain
()¶ Return the system default NIS domain.返回系统默认NIS域。
The nis
module defines the following exception:nis
模块定义以下异常:
-
exception
nis.
error
¶ An error raised when a NIS function returns an error code.NIS函数返回错误代码时引发的错误。