Skip to content

The Looker SDK failed with a 'Bad JSON: Unterminated string starting at...' error, but the same request worked via a direct API call. #1511

@sagarsalvi2011

Description

@sagarsalvi2011

We currently use looker-sdk==23.0.0 and cattr==23.1.2, and we’ve encountered an issue when calling the dashboard API for some dashboards. Specifically, we receive the following error:

API: /api/4.0/dashboards/23970?fields=id%2Ctitle%2Cdashboard_elements%2Cdashboard_filters%2Cdeleted%2Chidden%2Cdescription%2Cfolder%2Cuser_id%2Ccreated_at%2Cupdated_at%2Clast_updater_id%2Cdeleted_at%2Cdeleter_id
Error: Bad JSON - Unterminated string starting at: line 1 column 4535253 (char 4535252)

https://github.com/looker-open-source/sdk-codegen/blob/main/python/looker_sdk/rtl/serialize.py#L68
    return self.client.dashboard(
  File "/tmp/venv-looker-5a88e710ab336a26/lib/python3.10/site-packages/looker_sdk/sdk/api40/methods.py", line 4670, in dashboard
    self.get(
  File "/tmp/venv-looker-5a88e710ab336a26/lib/python3.10/site-packages/looker_sdk/rtl/api_methods.py", line 149, in get
    return self._return(response, structure)
  File "/tmp/venv-looker-5a88e710ab336a26/lib/python3.10/site-packages/looker_sdk/rtl/api_methods.py", line 106, in _return
    ret = self.deserialize(data=value, structure=structure)  # type: ignore
  File "/tmp/venv-looker-5a88e710ab336a26/lib/python3.10/site-packages/looker_sdk/rtl/serialize.py", line 68, in deserialize
    raise DeserializeError(f"Bad json {ex}")

Interestingly, it works as expected when we use the requests library to call the same API. I have verified that the data is correct when accessing the API directly, yet it fails when using the SDK.

Could you please help us resolve this issue?

Metadata

Metadata

Labels

p3Priority 3pythonPython SDK issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions