splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
687 stars 369 forks source link

UnicodeDecodeError: don't know how to handle UnicodeDecodeError in error callback #550

Closed faizanmansuri closed 8 months ago

faizanmansuri commented 11 months ago

I am trying to create a saved search (type alert) on Splunk using python-sdk. The problem I am facing is the alert gets created with the proper fields but it still throws an error UnicodeDecodeError: don't know how to handle UnicodeDecodeError in error callback.

To Reproduce Steps to reproduce the behavior:

  1. Install python-sdk and write a python code for creating saved search following README.md of python-sdk
  2. Create a saved search having below values
    alert_content = {
    "name": "Test Alert",
    "search": "QUERY",
    "alert_type": "number of events",
    "is_scheduled": "true",
    "cron_schedule": "0 9 * * 1",
    "alert_comparator": "greater than",
    "alert_threshold": 0,
    "app": "search",
    "actions": "email",
    "action.email": 1,
    "action.email.to": "test.user@gmail.com",
    }
  3. It would look something like this
    self.service.saved_searches.create(**alert_content)
  4. It creates the alert with proper fields and values but it also throws a below-given error.
    UnicodeDecodeError: don't know how to handle UnicodeDecodeError in error callback

Expected behavior Alert should be created without throwing an error.

Splunk (please complete the following information):

SDK (please complete the following information):

Additional context I have backtracked the functions where it is throwing error from So far I found that _load_atom in https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/client.py#L205C5-L205C15 is throwing the error.

ashah-splunk commented 11 months ago

Hi @faizanmansuri , we are unable to reproduce the issue. So can you please share other details such as Cluster configurations, as well as the response body that is received from the Splunk Enterprise. Also could you confirm if the issue exists only for the saved-search APIs or all the other APIs as well. Thanks!

faizanmansuri commented 8 months ago

Hi @ashah-splunk, Thanks for looking into it. I found that there is an issue with other APIs response as well in our specific Splunk environment So I don't think it is a SDK problem.