I have a simple external lookup python script that implements a simple post request and returns the result to the splunk search.I know the script will call splunk built-in python, so I suspect that there is a problem with the built-in ssl library , which causes the script to fail to request the https website.
When running python script with module requests to get https response,it occurrs a error 'NoneType' object has no attribute 'wrap_socket'.
If I put splunk's python executable file (/opt/splunk/bin/python2.7 ) soft link to linux os python, everything works fine. However, some functions of splunk become unusable. For example, splunk will return an error when creating a new user. This is because I changed the soft link of the splunk python executable. So I can't modify splunk's python program at random.
So how to solve this problem? Who can provide an example of an external lookup script that requests the https website?
all help would be greatly appreciated.
splunk verson 6.4.3
The easiest option would be to place the OS requests
module into your apps bin
directory so this will be loaded. Another option is to insert the OS Python module path before the Splunk Python module path in your script.
I did both previously in Python scripts and it work just fine.
cheers, MuS
The easiest option would be to place the OS requests
module into your apps bin
directory so this will be loaded. Another option is to insert the OS Python module path before the Splunk Python module path in your script.
I did both previously in Python scripts and it work just fine.
cheers, MuS
@MuS Good answer, I hope I can recommend your answer, because you write a comment, I can not recommend your answer.
Converted to answer 😉
cheers, MuS
As you have noticed, you should not try to replace/link the python packages with that of the local OS - bad things will happen.
@nickhillscpl OK,So is splunk's built-in SSL lib in wrong ? Have you ever used external lookups to request HTTPS websites? Have you ever encountered such a problem?