This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: splunklib.client does not handle Unicode characters
Type: behavior Stage: resolved
Components: Unicode Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, ezio.melotti, jpatel, vstinner
Priority: normal Keywords:

Created on 2020-09-16 18:09 by jpatel, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg377005 - (view) Author: Jay Patel (jpatel) Date: 2020-09-16 18:09
Using splunklib.client module to use Pythonic interface to the Splunk REST API. I am using the connect method of the module to connect and log in to a Splunk instance.

Code:
import splunklib.client as splunk_client
kwargs_config_flags = {
                'host': "test_instance漢字",
                'port': 8089,
                'username': <username>,
                'password': <password>,
                'owner': None,
                'app': None}
sc = splunk_client.connect(**kwargs_config_flags)

For python 3
Output:
''latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)'

I tried to encode the host to utf-8, "test_instance漢字".encode("utf-8")
Output:
'a bytes-like object is required, not 'str''

For python 2
It is working as expected.
output: 'nodename nor servname provided, or not known'

Is there a way by which this can be handled at the module level?
msg377011 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-09-16 18:57
This looks like an issue with splunklib, which is not distributed with python. 

I'm not sure if it's the same splunklib, but you might try https://github.com/IntegralDefense/splunklib
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85965
2020-09-26 07:54:43eric.smithsetstatus: pending -> closed
resolution: third party
stage: resolved
2020-09-16 22:34:38eric.smithsetstatus: open -> pending
2020-09-16 18:57:22eric.smithsetnosy: + eric.smith
messages: + msg377011
2020-09-16 18:09:57jpatelcreate