Splunk Dev

Splunk SDK for Python insane error need help

tesme
New Member

I am looking at the examples/abc of the python sdk and get an error

"connection = six.moves.http_client.HTTPSConnection(HOST, PORT)
NameError: name 'six' is not defined"

IT IS DEFINED?!
import splunklib.six.moves.http_client

Tags (1)
0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

Hi @tesme, Did the answer below solve your question? If yes, please click “Accept” directly below the answer to resolve the post. If not, please comment with more information if you are still having issues. Thanks!!

0 Karma

acharlieh
Influencer

It's not quite defined....

import splunklib.six.moves.http_client

makes splunklib.six.moves.http_client available but that's very different than six.moves.http_client (which is missing the leading splunklib. part)

As it seems they've been fairly consistent here in their invocation, I would alter that import statement like so:

import splunklib.six as six

Thus making six available in as a name, and thus everything resolves properly

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...