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

response.json() produces JSONDecodeError error since content is in invalid format #228

Open
pcnoic opened this issue Jun 21, 2021 · 0 comments

Comments

@pcnoic
Copy link

pcnoic commented Jun 21, 2021

Bug

When trying to work with the clientlogin method and using the default example from the documentation the user may encounter an issue where the response.json() produces json encoding error in the runtime. For example a common error would be:

simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Expected behavior

Received the response that is documented in the docs:

{  
   "clientlogin":{  
      "status":"PASS",
      "username":"William"
   }
}

Workaround

I'd suggest parsing the response using:

data = json.loads(response.content)

instead of:

data = response.json()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant