Splunk Dev

Find user does not working on Python code

Jooyoung
Path Finder

Following code is to find specific user("eveadams"). But it does not work.

# Find User
kwargs = {"name": "eveadams"}

try:
    users = service.users.list(**kwargs)
    for user in users:
        print "%s - %s" % (user.realname, user.name)

except: # new user
    print "Cannot find the user"

eveadams is already exist in splunk. But the result is always "Cannot find...".

Tags (1)
0 Karma

p_gurav
Champion

Can you try this:

kwargs = {"name": "eveadams"}
users = service.users.list(**kwargs)
 try:
     for user in users:
         print "%s - %s" % (user.realname, user.name)
 except: # new user
     print "Cannot find the user"
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...