Hi, I know this is late but I just wanted to share how I solved this myself. I used requests as jkat54 suggested, but used a session key rather than a hardcoded username and password. Because this is a modular input, the session key is passed in as part of the config XML - this can be seen here: http://docs.splunk.com/Documentation/Splunk/latest/AdvancedDev/ModInputsScripts
So I modified the part of my input which parsed the config out of that XML and added a section that pulls the session key out. From there you can just add it as a header to your request:
r = requests.post(uri, headers={'Authorization': 'Splunk %s' % sessionKey}, data={'name':'mySearch','value':'Hey ALL!','severity':'warn'}, verify=False)
... View more