ldap3.abstract.cursor module

class ldap3.abstract.cursor.Cursor(connection, object_def, get_operational_attributes=False, attributes=None, controls=None)

Bases: object

errors
failed
match(attributes, value)

Return entries with text in one of the specified attributes

match_dn(dn)

Return entries with text in DN

operations
remove(entry)
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)

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

clear()

Clear the Reader search parameters

components_in_and
entry_class

alias of Entry

entry_initial_status = 'Read'
query
reset()

Clear all the Reader parameters

search(attributes=None)

Perform the LDAP search

Returns:Entries found in search
search_level(attributes=None)

Perform the LDAP search operation with SINGLE_LEVEL scope

Returns:Entries found in search
search_object(entry_dn=None, attributes=None)

Perform the LDAP search operation SINGLE_OBJECT scope

Returns:Entry found in search
search_paged(paged_size, paged_criticality=True, generator=True, attributes=None)

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

search_subtree(attributes=None)

Perform the LDAP search operation WHOLE_SUBTREE scope

Returns:Entries found in search
class ldap3.abstract.cursor.Writer(connection, object_def, get_operational_attributes=False, attributes=None, controls=None)

Bases: ldap3.abstract.cursor.Cursor

attribute_class

alias of WritableAttribute

commit(refresh=True)
discard()
entry_class

alias of WritableEntry

entry_initial_status = 'Writable'
static from_cursor(cursor, connection=None, object_def=None, custom_validator=None)
static from_response(connection, object_def, response=None)
new(dn)
refresh_entry(entry, tries=4, seconds=2)