Getting Data In

Debugging python from the command line that needs a session key

jwhughes58
Contributor

Hi All,

I'm trying to debug netskope_email_notification.py from the TA-NetSkopeAppForSplunk by running this command.

splunk cmd python -m pdb netskope_email_notification.py

It runs until it hits this line

session_key = sys.stdin.readline().strip()

How do I get past this?  Maybe something like this, but with a session key.

splunk cmd python -m pdb netskope_email_notification.py < session_key

If so, how do you create an external session key?

TIA,

Joe

Labels (1)
Tags (2)
0 Karma

jwhughes58
Contributor

Thanks.  I hadn't thought of that.  Since I posted the question, NetSkope came back with a solution.  I was sent this

 

conf_file_stanzas = conf_file_object.get_all()
 
replace the above line with following:
 
conf_file_stanzas = conf_file_object.get_all(only_current_app=True)

 With that the issue was resolved.  The code was trying to get information from another TA.

0 Karma

marnall
Builder

Assuming you are on a linux machine, you could try piping the session_key value to that first command.

echo "sessionkeyhere" | splunk cmd python -m pdb netskope_email_notification.py

(Note that if you enter the key in explicitly, it may be saved in your command history which may be undesired. You can also read the key from a source using the "cat" command)

I couldn't tell you about the session_key... perhaps the Netskope docs could tell you where to get one. It could be a session with an email provider if this python script is intended to send email.

Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...