Skip to content

Commit

Permalink
start python recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
jstaf committed Jun 10, 2018
1 parent 86ac5ad commit 7a92e2d
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion docs/python_recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,39 @@ Anonymous bind

::

connection = ezldap.Connection('ldap://localhost')
connection = ezldap.Connection('ldap:///')

Bind using your credentials in ``~/.ezldap``
------------------------------------------------

::

connection = ezldap.auto_bind()

Bind manually
-------------------------------------

::

connection = ezldap.Connection('ldap:///', user='cn=someuser,dc=example,dc=com',
password='password')

Unbind from a directory
-----------------------------

::

connection.unbind()

Recommended workflow
------------------------------

Though it is possible to define a connection and later unbind.
It is often easier to just use the ``with`` keyword, that will unbind for you.

::

with ezldap.auto_bind() as con:
# do something with the "con" connection

(More documentation is on its way here, taking a break for now...)

0 comments on commit 7a92e2d

Please sign in to comment.