Unable to pass the hostname as unicode string? #34

Closed
hsebastian opened this Issue May 16, 2012 · 1 comment

Comments

Projects
None yet
3 participants

Hi,

We're using splunk-sdk and in our code we're getting the hostname as unicode string and pass it in like the example below. Is this be a bug or should my code handle it?

(env26_test)16:19 hsebastian@jemli ~> cat unicode.py 
import splunklib.client

service = splunklib.client.connect(host=u'localhost')
(env26_test)16:19 hsebastian@jemli ~> python unicode.py 
Traceback (most recent call last):
  File "unicode.py", line 3, in <module>
    service = splunklib.client.connect(host=u'localhost')
  File "/Users/hsebastian/storm_repo/env26_test/lib/python2.6/site-packages/splunklib/client.py", line 162, in connect
    return Service(**kwargs).login()
  File "/Users/hsebastian/storm_repo/env26_test/lib/python2.6/site-packages/splunklib/binding.py", line 206, in login
    password=self.password)
  File "/Users/hsebastian/storm_repo/env26_test/lib/python2.6/site-packages/splunklib/binding.py", line 372, in post
    return self.request(url, message)
  File "/Users/hsebastian/storm_repo/env26_test/lib/python2.6/site-packages/splunklib/binding.py", line 375, in request
    response = self.handler(url, message, **kwargs)
  File "/Users/hsebastian/storm_repo/env26_test/lib/python2.6/site-packages/splunklib/binding.py", line 430, in request
    connection.request(method, path, body, head)
  File "/Users/hsebastian/python267/lib/python2.6/httplib.py", line 914, in request
    self._send_request(method, url, body, headers)
  File "/Users/hsebastian/python267/lib/python2.6/httplib.py", line 951, in _send_request
    self.endheaders()
  File "/Users/hsebastian/python267/lib/python2.6/httplib.py", line 908, in endheaders
    self._send_output()
  File "/Users/hsebastian/python267/lib/python2.6/httplib.py", line 780, in _send_output
    self.send(msg)
  File "/Users/hsebastian/python267/lib/python2.6/httplib.py", line 739, in send
    self.connect()
  File "/Users/hsebastian/python267/lib/python2.6/httplib.py", line 1112, in connect
    sock = socket.create_connection((self.host, self.port), self.timeout)
  File "/Users/hsebastian/python267/lib/python2.6/socket.py", line 547, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.error: Int or String expected
Contributor

itay commented May 17, 2012

@hsebastian you are correct - it is a bug in the Python SDK. We have a fix, and it should be in the develop branch soon!

stelles closed this Jul 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment