All Apps and Add-ons

Does the Twilio app work with the python installed with splunk?

jcbfaulks
Explorer

I installed the twilio app and configured it per its documentation, but it is throwing an error saying that it can not import the module twilio.rest when trying to run the python scripts to pull down data. As far as I can tell there is no clear way to add a python module to splunk. Do you have to configure it to use an external python installation, or am I missing something here?

0 Karma
1 Solution

emiller42
Motivator

It doesn't appear that this app would ever work out of the box, as it attempts to use the Twilio Python Module, which isn't included in the app, and not mentioned in the instructions.

You can attempt to install the Twilio Python Module from the link above, but because Splunk uses it's own Python executable, I'm not sure how well that will work. I tried dropping it into the bin/ directory of the app and while it resolved your error, It just hit another include it didn't know what to do with:

[Eric@Erics-MacBook-Air bin]$ splunk cmd python get_call_logs.py 
Traceback (most recent call last):
  File "get_call_logs.py", line 6, in <module>
    from twilio.rest import TwilioRestClient
  File "/Applications/Splunk/etc/apps/twilio-app/bin/twilio/__init__.py", line 4, in <module>
    from six import u
ImportError: No module named six

You can go pull that module down and include it in the apps bin/ directory too, but that's getting a little ridiculous, and doesn't get the app working anyway. (After doing so, I got CertificateHostnameMismatch errors that can't be easily fixed)

Bottom line: Recommend contacting the developer of the app asking for a proper fix. The app as distributed seems unusable.

View solution in original post

himynamesdave
Contributor

Hey Jacob - sorry about this. Eric is right (thanks for the attempted fix!). I hacked my Splunk to get this to work originally and didn't really think when shipping the app in haste.

I'm actually working on updating this app to include calls to the Twilio API, bypassing the need for Python scripts completely. Should be complete in a few weeks.

In the meantime, I've shipped a new version with updated docs to include a loose workaround that will work in some environments.

dvavasour
Engager

Any guidance on OS/Python versions? I tried to get this working on CentOS 6.5 with Python 2.6.6, and both the scripts were throwing errors. My Python's not really good enough to debug this.

0 Karma

jyuan_splunk
Splunk Employee
Splunk Employee
0 Karma

emiller42
Motivator

None of that really applies when dealing with a Splunk app. Splunk bundles it's own Python interpreter, so it's not using the system Python, which all of those tips assume. One would expect any Splunk apps utilizing python to be entirely self-contained and run as expected out of the box without any additional Python environment configuration.

emiller42
Motivator

It doesn't appear that this app would ever work out of the box, as it attempts to use the Twilio Python Module, which isn't included in the app, and not mentioned in the instructions.

You can attempt to install the Twilio Python Module from the link above, but because Splunk uses it's own Python executable, I'm not sure how well that will work. I tried dropping it into the bin/ directory of the app and while it resolved your error, It just hit another include it didn't know what to do with:

[Eric@Erics-MacBook-Air bin]$ splunk cmd python get_call_logs.py 
Traceback (most recent call last):
  File "get_call_logs.py", line 6, in <module>
    from twilio.rest import TwilioRestClient
  File "/Applications/Splunk/etc/apps/twilio-app/bin/twilio/__init__.py", line 4, in <module>
    from six import u
ImportError: No module named six

You can go pull that module down and include it in the apps bin/ directory too, but that's getting a little ridiculous, and doesn't get the app working anyway. (After doing so, I got CertificateHostnameMismatch errors that can't be easily fixed)

Bottom line: Recommend contacting the developer of the app asking for a proper fix. The app as distributed seems unusable.

jcbfaulks
Explorer

Thanks for the answer. I actually got the CertificateHostnameMismatch error fixed by including httplib2 v0.8 in the bin directory of the app. That gets the scripts to actually run from command line, but still having some problems with it running correctly. In the end I decided to just scrap using the app and make my own.

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...