Splunk Dev

KeyError Urlencode('indexone') when trying to upload to splunk from python

sawgata12345
Path Finder

Hi,
I have a python UI using tkinter which is getting the credentials of splunk and the index in textboxes and
Then in backend executes code and collects some json data from switches.The trying to upload to splunk using the code below

spindex = user_args["splunk_index"] 
myindex = service.indexes[spindex ]
myindex.upload(uploadfile) #this uploadfile is a json file which is being uploaded

from UI i passed to textbox as 'indexone'
I am getting keyError: UrlEncoded('indexone') while above lines are executed

But if I directly write

myindex = service.indexes['indexone']

This works.
But i need to pass the index provided on the UI.
How to get rid of this KeyError?

xpac
SplunkTrust
SplunkTrust

Could you please add the complete error message?

0 Karma

sawgata12345
Path Finder

This is error msg
https://ibb.co/c8NOyJ

I have already created the index on splunk as mentioned in this error.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...