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

local variable 'response_json' referenced before assignment #18

Closed
yunhailuo opened this issue Aug 2, 2018 · 2 comments
Closed

local variable 'response_json' referenced before assignment #18

yunhailuo opened this issue Aug 2, 2018 · 2 comments

Comments

@yunhailuo
Copy link
Contributor

When POST fails here, response_json won't be assigned and even response.json may not be valid. This leads to an error here. Not sure what was intended here: response.content or response.text or others?

self.debug_logger.debug(euu.print_format_dict(response_json))

@nathankw
Copy link
Contributor

nathankw commented Aug 2, 2018

That's a recent bug I introduced. Will fix today, thanks for reporting.

@nathankw
Copy link
Contributor

nathankw commented Aug 2, 2018

Fixed in master. I moved line 1295 response_json = response.json() up one line above the if block.
In some cases of an error response, I noticed that the server doesn't always return JSON, which if I come across again will report for fixing on the server side. But the end point we are dealing with appears to return JSON just fine in error circumstances.

@nathankw nathankw closed this as completed Aug 2, 2018
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

2 participants