Ldaptor
=======
.. image:: https://img.shields.io/codecov/c/github/twisted/ldaptor?label=codecov&logo=codecov
:alt: Codecov
:target: https://codecov.io/gh/twisted/ldaptor
.. image:: https://img.shields.io/readthedocs/ldaptor?logo=read-the-docs
:alt: Read the Docs
:target: https://ldaptor.readthedocs.io/en/latest/
.. image:: https://img.shields.io/github/workflow/status/twisted/ldaptor/CI?label=GitHub%20Actions&logo=github
:alt: GitHub Actions
:target: https://github.com/twisted/ldaptor
.. image:: https://img.shields.io/pypi/v/ldaptor?logo=pypi
:alt: PyPI
:target: https://pypi.org/project/ldaptor/
.. image:: https://img.shields.io/badge/code%20style-black-black
:alt: Black
:target: https://github.com/psf/black
Ldaptor is a pure-Python library that implements:
- LDAP client logic
- separately-accessible LDAP and BER protocol message generation/parsing
- ASCII-format LDAP filter generation and parsing
- LDIF format data generation
- Samba password changing logic
Also included is a set of LDAP utilities for use from the command line.
Verbose documentation can be found on `ReadTheDocs <https://ldaptor.readthedocs.org>`_.
Quick Usage Example
-------------------
.. code-block:: python
from twisted.internet import reactor, defer
from ldaptor.protocols.ldap import ldapclient, ldapsyntax, ldapconnector
@defer.inlineCallbacks
def example():
# The following arguments may be also specified as unicode strings
# but it is recommended to use byte strings for ldaptor objects
serverip = b'192.168.128.21'
basedn = b'dc=example,dc=com'
binddn = b'bjensen@example.com'
bindpw = b'secret'
query = b'(cn=Babs*)'
c = ldapconnector.LDAPClientCreator(reactor, ldapclient.LDAPClient)
overrides = {basedn: (serverip, 389)}
client = yield c.connect(basedn, overrides=overrides)
yield client.bind(binddn, bindpw)
o = ldapsyntax.LDAPEntry(client, basedn)
results = yield o.search(filterText=query)
for entry in results:
print(entry.getLDIF())
if __name__ == '__main__':
df = example()
df.addErrback(lambda err: err.printTraceback())
df.addCallback(lambda _: reactor.stop())
reactor.run()
Installation
------------
Ldaptor can be installed using the standard command line method::
python setup.py install
or using pip from PyPI::
pip install ldaptor
Linux distributions may also have ready packaged versions of Ldaptor and Twisted. Debian and Ubuntu have quality Ldaptor packages that can be installed e.g., by::
apt-get install python-ldaptor
To run the LDAP server (bind port 38942) from a repo checkout with
the project installed::
twistd -n --pidfile=ldapserver.pid --logfile=ldapserver.log \
-y test-ldapserver.tac
Dependencies:
- `Twisted[tls] <https://pypi.python.org/pypi/Twisted/>`_
- `pyparsing <https://pypi.python.org/pypi/pyparsing/>`_
- `passlib <https://pypi.python.org/pypi/passlib/>`_ for Samba passwords
- `six <https://pypi.python.org/pypi/six/>`_ for simultaneous Python 2 and 3 compatability
- `zope.interface <https://pypi.python.org/pypi/zope.interface/>`_ to register implementers of Twisted interfaces
Raw data
{
"_id": null,
"home_page": "https://github.com/twisted/ldaptor",
"name": "ldaptor",
"maintainer": "Bret Curtis",
"docs_url": null,
"requires_python": "~=3.5",
"maintainer_email": "psi29a@gmail.com",
"keywords": "",
"author": "Tommi Virtanen",
"author_email": "tv@eagain.net",
"download_url": "https://files.pythonhosted.org/packages/e7/4f/15a982993f9deb931db600301468890228f4eb9a525fdd91eb160c32a31d/ldaptor-21.2.0.tar.gz",
"platform": "",
"description": "Ldaptor\n=======\n\n.. image:: https://img.shields.io/codecov/c/github/twisted/ldaptor?label=codecov&logo=codecov\n :alt: Codecov\n :target: https://codecov.io/gh/twisted/ldaptor\n.. image:: https://img.shields.io/readthedocs/ldaptor?logo=read-the-docs\n :alt: Read the Docs\n :target: https://ldaptor.readthedocs.io/en/latest/\n.. image:: https://img.shields.io/github/workflow/status/twisted/ldaptor/CI?label=GitHub%20Actions&logo=github\n :alt: GitHub Actions\n :target: https://github.com/twisted/ldaptor\n.. image:: https://img.shields.io/pypi/v/ldaptor?logo=pypi\n :alt: PyPI\n :target: https://pypi.org/project/ldaptor/\n.. image:: https://img.shields.io/badge/code%20style-black-black\n :alt: Black\n :target: https://github.com/psf/black\n\nLdaptor is a pure-Python library that implements:\n\n- LDAP client logic\n- separately-accessible LDAP and BER protocol message generation/parsing\n- ASCII-format LDAP filter generation and parsing\n- LDIF format data generation\n- Samba password changing logic\n\nAlso included is a set of LDAP utilities for use from the command line.\n\nVerbose documentation can be found on `ReadTheDocs <https://ldaptor.readthedocs.org>`_.\n\n\nQuick Usage Example\n-------------------\n\n.. code-block:: python\n\n from twisted.internet import reactor, defer\n from ldaptor.protocols.ldap import ldapclient, ldapsyntax, ldapconnector\n\n @defer.inlineCallbacks\n def example():\n # The following arguments may be also specified as unicode strings\n # but it is recommended to use byte strings for ldaptor objects\n serverip = b'192.168.128.21'\n basedn = b'dc=example,dc=com'\n binddn = b'bjensen@example.com'\n bindpw = b'secret'\n query = b'(cn=Babs*)'\n c = ldapconnector.LDAPClientCreator(reactor, ldapclient.LDAPClient)\n overrides = {basedn: (serverip, 389)}\n client = yield c.connect(basedn, overrides=overrides)\n yield client.bind(binddn, bindpw)\n o = ldapsyntax.LDAPEntry(client, basedn)\n results = yield o.search(filterText=query)\n for entry in results:\n print(entry.getLDIF())\n\n if __name__ == '__main__':\n df = example()\n df.addErrback(lambda err: err.printTraceback())\n df.addCallback(lambda _: reactor.stop())\n reactor.run()\n\n\nInstallation\n------------\n\nLdaptor can be installed using the standard command line method::\n\n python setup.py install\n\nor using pip from PyPI::\n\n pip install ldaptor\n\nLinux distributions may also have ready packaged versions of Ldaptor and Twisted. Debian and Ubuntu have quality Ldaptor packages that can be installed e.g., by::\n\n apt-get install python-ldaptor\n\nTo run the LDAP server (bind port 38942) from a repo checkout with\nthe project installed::\n\n twistd -n --pidfile=ldapserver.pid --logfile=ldapserver.log \\\n -y test-ldapserver.tac\n\nDependencies:\n\n- `Twisted[tls] <https://pypi.python.org/pypi/Twisted/>`_\n- `pyparsing <https://pypi.python.org/pypi/pyparsing/>`_\n- `passlib <https://pypi.python.org/pypi/passlib/>`_ for Samba passwords\n- `six <https://pypi.python.org/pypi/six/>`_ for simultaneous Python 2 and 3 compatability\n- `zope.interface <https://pypi.python.org/pypi/zope.interface/>`_ to register implementers of Twisted interfaces\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Pure-Python Twisted library for LDAP",
"version": "21.2.0",
"project_urls": {
"Homepage": "https://github.com/twisted/ldaptor"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb46dc64e99bdb84d76db673de4b86447626a99bd121335f5496491645b764a5",
"md5": "bc1c022e8b5a0261eac643bca9e720d1",
"sha256": "70521851c74b67b340619fc58bb7105619714e40287309572edb6e86f6d75bd0"
},
"downloads": -1,
"filename": "ldaptor-21.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc1c022e8b5a0261eac643bca9e720d1",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": "~=3.5",
"size": 179366,
"upload_time": "2021-02-28T23:59:55",
"upload_time_iso_8601": "2021-02-28T23:59:55.543813Z",
"url": "https://files.pythonhosted.org/packages/bb/46/dc64e99bdb84d76db673de4b86447626a99bd121335f5496491645b764a5/ldaptor-21.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e74f15a982993f9deb931db600301468890228f4eb9a525fdd91eb160c32a31d",
"md5": "c15281c5d64bdc4b48df2a5341432b5a",
"sha256": "8c49eb19375d4aab3e5b835860614e0cb17e56bb5a20e1874808fa5bec67a358"
},
"downloads": -1,
"filename": "ldaptor-21.2.0.tar.gz",
"has_sig": false,
"md5_digest": "c15281c5d64bdc4b48df2a5341432b5a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.5",
"size": 301547,
"upload_time": "2021-02-28T23:59:56",
"upload_time_iso_8601": "2021-02-28T23:59:56.848183Z",
"url": "https://files.pythonhosted.org/packages/e7/4f/15a982993f9deb931db600301468890228f4eb9a525fdd91eb160c32a31d/ldaptor-21.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-02-28 23:59:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "twisted",
"github_project": "ldaptor",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ldaptor"
}