Skip to main content

ldapper

Build Status Documentation Status

ldapper is a hassle-free Python LDAP ORM for getting real work done.

It extends the robust capabilities of python-ldap and augments it with higher-level interfaces to define your schema. Listing and fetching all your LDAP objects is easy and straightforward. Modifications and validation can be made with assurance using ldapper.

Requirements

ldapper requires:

  • Python 3.6+
  • inflection

Version 0.9.0 was the last to support Python 2.

Usage

from ldapper.connection import BaseConnection
from ldapper.ldapnode import LDAPNode
from ldapper import fields


# define a connection
class Connection(BaseConnection):
    BASE_DN = 'dc=example,dc=com'
    URI = 'ldaps://ldap.example.com'


# define a common LDAPNode that holds the connection class you defined
class BaseModel(LDAPNode):
    connection = Connection


# define a class to represent people
class Person(BaseModel):
    uid = fields.StringField('uid', primary=True)
    uidnumber = fields.IntegerField('uidNumber')
    firstname = fields.StringField('givenName')
    lastname = fields.StringField('sn')
    email_addresses = fields.ListField('mailLocalAddress')
    photo = fields.BinaryField('jpegPhoto', optional=True)

    class Meta:
        objectclasses = ['top', 'inetOrgPerson', 'inetLocalMailRecipient']
        dn_format = 'uid=%(uid)s,ou=people'
        primary_dnprefix = 'ou=people'
        secondary_dnprefix = 'ou=people'
        identifying_attrs = ['uid']
        searchable_fields = [
'uid', 'uidNumber', 'givenName', 'sn', 'mailLocalAddress']


# use the Person class
person = Person.fetch('liam')
person.displayname = 'Chuck Yeager'
person.save()
person.delete()


from ldapper.query import Q
Person.filter(Q(firstname='Foo') | Q(lastname='Bar'))

Documentation

Available at https://ldapper.readthedocs.io/

Testing

Please see the README.md file in the test directory for information on running unit tests.

Release files for ldapper 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ldapper 1.0.3
File Size Uploaded
ldapper-1.0.3.tar.gz 28.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ldapper 1.0.3
File Interpreter ABI Platform
ldapper-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size:59.8 kB

Release files / ldapper-1.0.3.tar.gz

Download URL ldapper-1.0.3.tar.gz
Size 28.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc41f459dcd221002d57e02604e942f326877bb376e959dfb5464dd326842c80
BLAKE2b-256 checksum
How to use checksums
a7699c59d15c3aba35182870b76ba882c0de0b07288767df7a44c7c2657486cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

Release files / ldapper-1.0.3-py3-none-any.whl

Download URL ldapper-1.0.3-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98c64cfe65607059959350117ed291ac4a9b6114453f131575862767e7ed6a71
BLAKE2b-256 checksum
How to use checksums
3a00b18c0f62babc53834dc95c6042e3b278bb5589aa7af083c20a691a3f2d15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page