From 2b44855f0290f9931e533a670ef1c14291217c6d Mon Sep 17 00:00:00 2001 From: nanu2 Date: Tue, 16 Sep 2014 12:56:27 +0200 Subject: [PATCH] README.md to README.rst --- CHANGES.txt | 3 +- MANIFEST | 14 ++++---- README.md | 95 ----------------------------------------------------- setup.py | 5 ++- 4 files changed, 11 insertions(+), 106 deletions(-) delete mode 100644 README.md diff --git a/CHANGES.txt b/CHANGES.txt index f524a22..53bde43 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 0.1 - initial version 0.1.1 - fixed pretty print of binary attribute - fixed ldap.get sizelimit=1 exception for now - - added try catch to api \ No newline at end of file + - added try catch to api +0.1.2 - README.md to README.rst \ No newline at end of file diff --git a/MANIFEST b/MANIFEST index 6aacb81..4bcf614 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,11 +1,11 @@ # file GENERATED by distutils, do NOT edit +CHANGES.txt LICENSE.txt MANIFEST.in -README.md setup.py -ldapper/__init__.py -ldapper/api.py -ldapper/connection.py -ldapper/ldapperobject.py -ldapper/test/__init__.py -ldapper/test/test_ldapper.py +ldappr/__init__.py +ldappr/api.py +ldappr/connection.py +ldappr/ldapprobject.py +ldappr/test/__init__.py +ldappr/test/test_ldappr.py diff --git a/README.md b/README.md deleted file mode 100644 index 15749b0..0000000 --- a/README.md +++ /dev/null @@ -1,95 +0,0 @@ -Ldappr -======= - -[![PyPI version](https://badge.fury.io/py/ldappr.svg)](http://badge.fury.io/py/ldappr) - -Ldappr is a wrapper around python-ldap, meant for quick and easy handling of -common administrative tasks concerning your LDAP compliant repository. It is -particularly useful in small, one-time scripts to get things done, or -interactively within an iPython shell. - -Installation ------------- - -Of course, python-ldap is supposed to be already installed. - -``` -pip install ldappr -``` - -Connect -------- - -```python -import ldappr - -# authenticated bind -ldap = ldappr.connect_to('127.0.0.1', 'uid=admin,ou=system', 'secret') -``` - -Retrieve objects ----------------- - -When you have a connection, you can search on it. First, specify the seach base. - -```python -ldap.search_base = 'ou=users,ou=system' -``` - -Then, get one or more objects to manipulate. - -```python -# retrieve a single object -user = ldap.get('cn=jdoe') - -# retrieve a list of objects -users = ldap.search('objectClass=inetOrgPerson') -``` - -Do stuff --------- - -Once you got an object, you can easily manipulate it. All changes will -immediately reflect in your LDAP repository. - -```python -# pretty print the retrieved user -print(user) - -# get an attribute value -sn = user.attrs['sn'] - -# set an attribute value (existing value will be removed) -user.set_value('givenName', 'Jack') - -# add a value to a multi-valued attribute -user.add_value('mobile', '0123456789') -user.add_value('mobile', '9876543210') - -# remove a value from a multi-valued attribute -user.remove_value('mobile', '9876543210') -``` - -Other examples --------------- -```python -# anonymous bind -ldap = ldappr.connect_to('127.0.0.1') - -# authenticated bind with more options -ldap = ldappr.connect_to('127.0.0.1', 'uid=admin,ou=system', 'secret', - protocol='ldaps', port='10636', verify=False, - search_base='ou=users,ou=system') - -# delete all objects with employeeType manager -for dn in ldap.get_dn('employeeType=manager'): - ldap.delete(dn) - -# set an attribute value for a known dn -ldap.set_value('cn=jdoe,ou=users,ou=system', 'givenName', 'Jack') - -# make an LDIF export for all users -with open('export.ldif', 'a') as file: - for user in ldap.search('objectClass=inetOrgPerson'): - file.write(user.to_ldif()) -``` diff --git a/setup.py b/setup.py index 72c120b..14851e7 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,12 @@ from distutils.core import setup -with open('README.md') as fh: +with open('README.rst') as fh: long_description = fh.read() setup( name='ldappr', - version='0.1', + version='0.1.2', packages=['ldappr', 'ldappr.test'], - install_requires=['python-ldap'], url='https://github.com/nanu2/ldappr', license='ICS', author='Mike Helderman',