Blog Archive for January 14, 2010

Accessing Active Directory LDAP

January 14, 2010

Active Directory exposes an LDAP interface. This makes it possible to talk to the service using an LDAP client.

Authenticating

Here's an example of talking to Active Directory from python code:

>>> import ldap
>>> con = ldap.initialize('ldap://server:port')
>>> dn = 'domain\username'
>>> password = …

Reading XLS files in Python

January 14, 2010

The xlrd library, available at http://www.python-excel.org/ allows you to read xls files from python code.

Download and install the library, knock up a suitable test file in Excel, then try the following code in a python shell:

>>> from mmap import mmap,ACCESS_READ
>>> from xlrd import open_workbook

>>> …

Tags: python xls