Cog-Creators / Cog-Creators/Red-DiscordBot

Calls to Spotify API can raise exception when the response is not JSON

Open
#6,776 0 comments 0 reactions 0 assignees View on GitHub
Category: Cogs - Audio Status: Accepted Status: PRs Welcome Type: Bug
Dominant language
Python
Stars
5.7k
Forks
2.5k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Report by alec in discord. When the status of request to fetch token from spotify isn't 200, The content-type is not json.
Image

While we are still here, the `self.get()` suffers from the same problem, it tries to parse json despite the response not necessarily being one (mostly when response status is 5xx). Fixing the get req needs lots of other changes and error handling pretty much all over the api interface, because it is used in many places unlike post (which just occurs once).

_Originally posted by @npc203 in https://github.com/Cog-Creators/Red-DiscordBot/issues/5359#issuecomment-932720142_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.