- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I have created a Splunk app and am sending ajax request to it from the browser.
The serverside python code will then make REST calls to Splunk.
I need access to the logged-in user's sessionKey to make my REST calls to Splunk.
How do I get it?
(I am actually asking this rhetorically since I know how to do it... but couldn't find the answer here)
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just use the service object, getting it from the http request
// your http/ ajax controller
def home(request):
service = request.service
savedsearches = service.saved_searches
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

My ajax controller looks like:
@expose_page(must_login=True, trim_spaces=True, methods=['GET'])
def getCurrent(self, **params):
where params is a dict {'type':'alert',.... }
I can't seem to get access to the request
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

import cherrypy
sessionKey = cherrypy.session['sessionKey']
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I downvoted this post because this did not seem to work for me. i have the following error:
attributeerror: 'module' object has no attribute 'session'
do you have a move complete answer?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I may have missed something, but this does not work with Django Bindings apps.
File "/opt/splunk/etc/apps/myapp/django/myapp/views.py", line 158, in privat
session_key = cherrypy.session["sessionKey"]
File "/opt/splunk/lib/python2.7/site-packages/cherrypy/__init__.py", line 322, in __getitem__
child = getattr(serving, self.__attrname__)
AttributeError: '_Serving' object has no attribute 'session'
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this stuff really doesn't work
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's a lot easier to just use request.service if you want to use REST.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Question: is there an official splunk API call that I can use that will shield me from using cherrypy internals to get this information out of the request?
