Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sagarsalvi2011 opened this issue Oct 1, 2024 · 1 comment
Labels
p3 Priority 3 python Python SDK issues

Comments

@sagarsalvi2011
Copy link

sagarsalvi2011 commented Oct 1, 2024

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?

@github-actions github-actions bot added need triage p3 Priority 3 labels Oct 1, 2024
@sagarsalvi2011 sagarsalvi2011 changed the title Looker SDK Failed with Bad json Unterminated string starting at but same think is worked via direct api call. The Looker SDK failed with a 'Bad JSON: Unterminated string starting at...' error, but the same request worked via a direct API call. Oct 1, 2024
@drstrangelooker drstrangelooker added python Python SDK issues and removed need triage labels Oct 11, 2024
@drstrangelooker
Copy link
Collaborator

Can you confirm this is an issue with the latest versions of the SDK?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 Priority 3 python Python SDK issues
Projects
None yet
Development

No branches or pull requests

3 participants
@drstrangelooker @sagarsalvi2011 and others