splunk-sdk-python icon indicating copy to clipboard operation
splunk-sdk-python copied to clipboard

Can't convert 'bytes' object to str implicitly

Open AimeSoleil opened this issue 9 years ago • 3 comments

Is branch python3-port ready for Python3? I've installed the sdk based on branch python3-port.

It comes to above error when trying connect splunk deamon.

File "E:\Python3.5.1\lib\site-packages\splunk_sdk-1.5.0-py3.5.egg\splunklib\binding.py", line 1292, in read r = r + self._response.read(size)

Code:

class SplunkClient:

    connection_kargs = {}

    def __init__(self, host, port, username, password):
        self.connection_kargs['host'] = host
        self.connection_kargs['port'] = port
        self.connection_kargs['username'] = username
        self.connection_kargs['password'] = password

    def connect(self):
        return client.connect(**self.connection_kargs)

   if __name__ == "__main__":
       server = SplunkClient(HOST, PORT, USERNAME, PASSWORD).connect()
       for app in server.apps:
           print(app.name)

AimeSoleil avatar Jul 11 '17 10:07 AimeSoleil

Looks like last commit was 2016 so my guess is that it's an abandoned experiment. I have a PR with Python 3 Support, it's only tested with the unittest suite and need more testing so if you want to do that go ahead. https://github.com/Tltx/splunk-sdk-python

tltx avatar Jul 12 '17 17:07 tltx

@juliansxw We are reviewing #191 and will see if this is still a problem after that PR is merged.

snickers2029 avatar Feb 23 '18 18:02 snickers2029

@juliansxw I manually verified this with Python 3.5.1 locally on the develop branch (after merging #191).

shakeelmohamed avatar Feb 26 '18 18:02 shakeelmohamed