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!

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...