diff --git a/README.md b/README.md index 6b92a179a..8e2c35c0f 100644 --- a/README.md +++ b/README.md @@ -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= + +Using Session key + + python examplename.py --sessionKey="" + If you saved your login credentials in the **.splunkrc** file, you can omit those arguments: python examplename.py diff --git a/scripts/templates/splunkrc.template b/scripts/templates/splunkrc.template index 7f00b04ba..b98f93af6 100644 --- a/scripts/templates/splunkrc.template +++ b/scripts/templates/splunkrc.template @@ -10,3 +10,7 @@ password=$password scheme=$scheme # Your version of Splunk (default: 6.2) version=$version +# Bearer token for authentication +#bearerToken= +# Session key for authentication +#sessionKey= diff --git a/utils/__init__.py b/utils/__init__.py index b74099ba9..f38027efe 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -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' } }