ldap3.abstract package¶
Submodules¶
ldap3.abstract.attrDef module¶
-
class
ldap3.abstract.attrDef.
AttrDef
(name, key=None, validate=None, pre_query=None, post_query=None, default=NotImplemented, dereference_dn=None, description=None, mandatory=False, single_value=None, alias=None)[source]¶ Bases:
object
Hold the definition of an attribute
Parameters: - name (string) – the real attribute name
- key (string) – the friendly name to use in queries and when accessing the attribute, default to the real attribute name
- validate (callable) – called to check if the value in the query is valid, the callable is called with the value parameter
- pre_query (callable) – called to transform values returned by search
- post_query (callable) – called to transform values returned by search
- default (string, integer) – value returned when the attribute is absent (defaults to NotImplemented to allow use of None as default)
- dereference_dn (ObjectDef) – reference to an ObjectDef instance. When the attribute value contains a dn it will be searched and substituted in the entry
- description (string) – custom attribute description
- mandatory (boolean) – specify if attribute is defined as mandatory in LDAP schema
ldap3.abstract.attribute module¶
-
class
ldap3.abstract.attribute.
Attribute
(attr_def, entry, cursor)[source]¶ Bases:
object
Attribute/values object, it includes the search result (after post_query transformation) of each attribute in an entry
Attribute object is read only
- values: contain the processed attribute values
- raw_values’: contain the unprocessed attribute values
-
value
¶ Returns: The single value or a list of values of the attribute.
-
class
ldap3.abstract.attribute.
OperationalAttribute
(attr_def, entry, cursor)[source]¶ Bases:
ldap3.abstract.attribute.Attribute
Operational attribute/values object. Include the search result of an operational attribute in an entry
OperationalAttribute object is read only
- values: contains the processed attribute values
- raw_values: contains the unprocessed attribute values
It may not have an AttrDef
ldap3.abstract.cursor module¶
-
class
ldap3.abstract.cursor.
Cursor
(connection, object_def, get_operational_attributes=False, attributes=None, controls=None, auxiliary_class=None)[source]¶ Bases:
object
-
errors
¶
-
failed
¶
-
operations
¶
-
-
class
ldap3.abstract.cursor.
Operation
(request, result, response)¶ Bases:
tuple
-
request
¶ Alias for field number 0
-
response
¶ Alias for field number 2
-
result
¶ Alias for field number 1
-
-
class
ldap3.abstract.cursor.
Reader
(connection, object_def, base, query='', components_in_and=True, sub_tree=True, get_operational_attributes=False, attributes=None, controls=None, auxiliary_class=None)[source]¶ Bases:
ldap3.abstract.cursor.Cursor
Reader object to perform searches:
Parameters: - connection (LDAPConnection) – the LDAP connection object to use
- object_def (ObjectDef) – the ObjectDef of the LDAP object returned
- query (str) – the simplified query (will be transformed in an LDAP filter)
- base (str) – starting base of the search
- components_in_and (bool) – specify if assertions in the query must all be satisfied or not (AND/OR)
- sub_tree (bool) – specify if the search must be performed ad Single Level (False) or Whole SubTree (True)
- get_operational_attributes (bool) – specify if operational attributes are returned or not
- controls (tuple) – controls to be used in search
-
attribute_class
¶ alias of
Attribute
-
components_in_and
¶
-
entry_class
¶ alias of
Entry
-
entry_initial_status
= 'Read'¶
-
query
¶
-
search_level
(attributes=None)[source]¶ Perform the LDAP search operation with SINGLE_LEVEL scope
Returns: Entries found in search
-
search_object
(entry_dn=None, attributes=None)[source]¶ Perform the LDAP search operation SINGLE_OBJECT scope
Returns: Entry found in search
-
search_paged
(paged_size, paged_criticality=True, generator=True, attributes=None)[source]¶ Perform a paged search, can be called as an Iterator
Parameters: - attributes – optional attributes to search
- paged_size (int) – number of entries returned in each search
- paged_criticality (bool) – specify if server must not execute the search if it is not capable of paging searches
- generator (bool) – if True the paged searches are executed while generating the entries, if False all the paged searches are execute before returning the generator
Returns: Entries found in search
-
class
ldap3.abstract.cursor.
Writer
(connection, object_def, get_operational_attributes=False, attributes=None, controls=None, auxiliary_class=None)[source]¶ Bases:
ldap3.abstract.cursor.Cursor
-
attribute_class
¶ alias of
WritableAttribute
-
entry_class
¶ alias of
WritableEntry
-
entry_initial_status
= 'Writable'¶
-
ldap3.abstract.entry module¶
-
class
ldap3.abstract.entry.
Entry
(dn, cursor)[source]¶ Bases:
ldap3.abstract.entry.EntryBase
The Entry object contains a single LDAP entry. Attributes can be accessed either by sequence, by assignment or as dictionary keys. Keys are not case sensitive.
The Entry object is read only
- The DN is retrieved by entry_dn
- The Reader reference is in _cursor()
- Raw attributes values are retrieved by the _ra_attributes and _raw_attribute() methods
-
class
ldap3.abstract.entry.
EntryBase
(dn, cursor)[source]¶ Bases:
object
The Entry object contains a single LDAP entry. Attributes can be accessed either by sequence, by assignment or as dictionary keys. Keys are not case sensitive.
The Entry object is read only
- The DN is retrieved by entry_dn
- The cursor reference is in _cursor
- Raw attributes values are retrieved with _raw_attributes and the _raw_attribute() methods
-
entry_attributes
¶
-
entry_attributes_as_dict
¶
-
entry_cursor
¶
-
entry_definition
¶
-
entry_dn
¶
-
entry_mandatory_attributes
¶
-
entry_raw_attribute
(name)[source]¶ Parameters: name – name of the attribute Returns: raw (unencoded) value of the attribute, None if attribute is not found
-
entry_raw_attributes
¶
-
entry_read_time
¶
-
entry_status
¶
-
class
ldap3.abstract.entry.
EntryState
(dn, cursor)[source]¶ Bases:
object
Contains data on the status of the entry. Does not pollute the Entry __dict__.
-
class
ldap3.abstract.entry.
WritableEntry
(dn, cursor)[source]¶ Bases:
ldap3.abstract.entry.EntryBase
-
entry_changes
¶
-
entry_virtual_attributes
¶
-
ldap3.abstract.objectDef module¶
-
class
ldap3.abstract.objectDef.
ObjectDef
(object_class=None, schema=None, custom_validator=None, auxiliary_class=None)[source]¶ Bases:
object
Represent an object in the LDAP server. AttrDefs are stored in a dictionary; the key is the friendly name defined in AttrDef.
AttrDefs can be added and removed using the += and -= operators
ObjectDef can be accessed either as a sequence and a dictionary. When accessed the whole AttrDef instance is returned