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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...