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!

Leveraging Detections from the Splunk Threat Research Team & Cisco Talos

  Now On Demand  Stay ahead of today’s evolving threats with the combined power of the Splunk Threat Research ...

New in Splunk Observability Cloud: Automated Archiving for Unused Metrics

Automated Archival is a new capability within Metrics Management; which is a robust usage & cost optimization ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...