<commit_before>pyLDAP
======

Python 3.x wrapper for libldap2.

Requirements for building
=========================

- python3.x-dev (tested with 3.2 and 3.3)
- libldap2-dev
- libsasl2-dev

Examples
========
```python
    import pyLDAP
    client = pyLDAP.LDAPClient("ldap://example.com/")
    client.connect("cn=admin,dc=example,dc=com", "secret")
    entry = client.get_entry("cn=test,dc=example,dc=com")
    entry['mail'] = "<EMAIL>"
    entry.modify()
    client.close()
```
<commit_msg>Update readme with a longer description and more examples.<commit_after>pyLDAP
======

This is a Python module for wrapping libldap2. *Heavily* under development. <br/>
Support only Python 3.x, and LDAPv3. <br/>
Written completely in C. Uses only synchronous LDAP operations at the moment. <br/>
<br/>
This is my first public Python module, and very first time for me to use the Python/C API.
Contributions and advices are welcome. :) (Just tell me the whats and whys.)  


Requirements for building
=========================

- python3.x-dev (tested with 3.2 and 3.3)
- libldap2-dev
- libsasl2-dev

Examples
========
Add a new attribute (mail) for an existing entry:
```python
    import pyLDAP
    client = pyLDAP.LDAPClient("ldap://example.com/")
    client.connect("cn=admin,dc=example,dc=com", "secret")
    entry = client.get_entry("cn=test,dc=example,dc=com")
    entry['mail'] = "<EMAIL>"
    entry.modify()
    client.close()
```
Add a new entry:
```python
    import pyLDAP
    client = pyLDAP.LDAPClient("ldap://example.com/")
    client.connect("cn=admin,dc=example,dc=com", "secret")
    entry = pyLDAP.LDAPEntry("cn=test,dc=example,dc=com", client)
    entry['objectClass'] = ["top", "organizationalPerson", "inetOrgPerson"]
    # Case-insenstitve dict.
    entry['ObjEctClaSS'].append("person")
    entry['sn'] = "Smith"
    entry['gn'] = "John"
    entry.add()
    client.close()
```
Search:
```python
    import pyLDAP
    client = pyLDAP.LDAPClient("ldap://example.com/")
    client.connect()
    client.search(base="dc=example.dc=com", scope=2)
```
Delete:
```python
    import pyLDAP
    client = pyLDAP.LDAPClient("ldap://example.com/")
    client.connect("cn=admin,dc=example,dc=com", "secret")
    client.del_entry("cn=test,dc=example.dc=com")
    client.close()
```
or (keeping the data on the local machine):
```python
    import pyLDAP
    client = pyLDAP.LDAPClient("ldap://example.com/")
    client.connect("cn=admin,dc=example,dc=com", "secret")
    entry = client.get_entry("cn=test,dc=example.dc=com")
    entry.delete()
    client.close()
```

{'fraction_non_alphanumeric': 0.18316445830085737, 'fraction_numerical': 0.00779423226812159, 'mean_word_length': 4.12375249500998, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2383868', 'n_tokens_mistral': 910, 'n_tokens_neox': 870, 'n_words': 202}