Skip to content Skip to sidebar Skip to footer

Python To Fetch Ldap Credentials From Json File

I have the following line of code in a python script to bind to LDAP using my credentials(assuming username is 'abcdef', and password is '123456': l.simple_bind_s('domain\abcdef',

Solution 1:

That's a minimalist example of how to get values from a json file.

import json

with open('creds.json') as data_file:
    data = json.load(data_file)


user = data['username']
pwd =  data['password']

print(user)
print(pwd)

I take from this answer: https://stackoverflow.com/a/2835672/4172067

Post a Comment for "Python To Fetch Ldap Credentials From Json File"