Skip to content

Instantly share code, notes, and snippets.

View mattfahrner's full-sized avatar

Matt Fahrner mattfahrner

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mattfahrner on github.
  • I am mattfahrner (https://keybase.io/mattfahrner) on keybase.
  • I have a public key ASDI3dYp1WxJelYEA2VjWig4fSuSNRX_WAxOE0pm39eVhAo

To claim this, I am signing this object:

@mattfahrner
mattfahrner / python-paged-ldap-snippet-2.4.py
Last active January 16, 2024 12:39
This snippet allows you to do a Python LDAP search with paged controls. The latest version now supports Python "ldap" 2.4. Many thanks to Ilya Rumyantsev for doing the 2.4 legwork.
#! /usr/bin/python
import sys
import ldap
from ldap.controls import SimplePagedResultsControl
from distutils.version import LooseVersion
# Check if we're using the Python "ldap" 2.4 or greater API
LDAP24API = LooseVersion(ldap.__version__) >= LooseVersion('2.4')