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!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...