Git Product home page Git Product logo

pywldap's Introduction

PyWldap

Build Status Code Coverage

Python wrapper over Windows Wldap32 library.

Overview

This package provides bindings and pythonic wrapper over Wldap32.dll (see Microsoft MSDN page regarding this library).

If you need to access LDAP from Python, you most likely want Python LDAP. However, Python LDAP is built over OpenLDAP which lacks binding methods other than LDAP_AUTH_SIMPLE.

Usage

>>> import wldap
>>> l = wldap.ldap('ldap://xxx')
>>> l.bind_s(None, None, wldap.LDAP_AUTH_DIGEST)
>>> m = l.search_s('DN=world', wldap.LDAP_SCOPE_SUBTREE,
                   '(&(objectClass=user)(cn=icecrime))', ['cn'], 0)
>>> wldap.parse_message(m)
[{u'cn': u'Arnaud Porterie'}]

License

Copyright 2013 Arnaud Porterie

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

pywldap's People

Contributors

icecrime avatar

Stargazers

Yili He avatar Brandon Dowdy avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

pywldap's Issues

ctypes.ArgumentError

Win 7 x64, Python 3.3 x64

import wldap
l = wldap.ldap('ldap://test')
Traceback (most recent call last):
  File ".\wldap.py", line 469, in __init__
    self._l = dll.ldap_init(hostName, portNumber)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

parse_message doesnt accept Message

Hi! I need to receive attribute value from some ad user

>>> import wldap
>>> l = wldap.ldap('ts.main')
>>> l.bind_s(None, None, wldap.LDAP_AUTH_DIGEST)
0
>>> m = l.search_s('dc=ts,dc=main', wldap.LDAP_SCOPE_SUBTREE, '(&(objectCategory=person)(objectClass=user)(cn=test1))', ['telephoneNumber'], 0)
>>> m
<wldap.Message object at 0x0000000002D38C18>
>>> wldap.parse_message(m)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".\wldap\__init__.py", line 362, in parse_message
    for entry in message:
TypeError: iter() returned non-iterator of type 'MessageIterator'

next I try to do something like this

>>> wldap.dll.ldap_get_values(l,'cn=test1,ou=ou test,dc=ts,dc=main','telephoneNumber')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".\wldap\wldap32_dll.py", line 334, in _wrapped
    return getattr(dll, fn_data.api_name)(*args, **kwargs)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

but i don't understand how work with ctypes :(

Is the any easy way to get (and set :) ) values from known attributes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.