-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[Audio] Spotify post request fix #5359
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
base: V3/develop
Are you sure you want to change the base?
Conversation
|
While we are still here, the |
| """Make a POST call to spotify.""" | ||
| async with self.session.post(url, data=payload, headers=headers) as r: | ||
| data = await r.json(loads=json.loads) | ||
| if r.status != 200: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still should be checking for status code as some (if not most) non-200 responses contain valid JSON. Yes, with current usage this doesn't technically matter but we should be doing it nonetheless.
If we do this, we could probably even simplify get_access_token() and remove the try-except with KeyError from it and just directly assign instead.
I suppose this could be added to this PR as well, it's part of the same issue. |
Description of the changes
Report by alec in discord. When the status of request to fetch token from spotify isn't 200, The content-type is not json.
This PR handles it ,makes sure the error is propagated and handled.