Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,18 @@ Save the file as **.splunkrc** in the current user's home directory.

Examples are located in the **/splunk-sdk-python/examples** directory. To run the examples at the command line, use the Python interpreter and include any arguments that are required by the example. In the commands below, replace "examplename" with the name of the specific example in the directory that you want to run:

Using username and Password

python examplename.py --username="admin" --password="changeme"

Using Bearer token

python examplename.py --bearerToken=<value>

Using Session key

python examplename.py --sessionKey="<value>"

If you saved your login credentials in the **.splunkrc** file, you can omit those arguments:

python examplename.py
Expand Down
4 changes: 4 additions & 0 deletions scripts/templates/splunkrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ password=$password
scheme=$scheme
# Your version of Splunk (default: 6.2)
version=$version
# Bearer token for authentication
#bearerToken=<Bearer-token>
# Session key for authentication
#sessionKey=<Session-Key>
10 changes: 10 additions & 0 deletions utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ def config(option, opt, value, parser):
'flags': ["--version"],
'default': None,
'help': 'Ignore. Used by JavaScript SDK.'
},
'splunkToken': {
'flags': ["--bearerToken"],
'default': None,
'help': 'Bearer token for authentication'
},
'token': {
'flags': ["--sessionKey"],
'default': None,
'help': 'Session key for authentication'
}
}

Expand Down