[PR #673] [CLOSED] retrieve proper message and reason when response can't be loaded to json #990

Closed
opened 2026-02-28 00:03:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/spotipy-dev/spotipy/pull/673
Author: @gustavokrieger
Created: 4/19/2021
Status: Closed

Base: masterHead: non-json-response-proper-error-message


📝 Commits (1)

  • 4022b8d retrieve proper message and reason when response can't be loaded to json

📊 Changes

1 file changed (+26 additions, -8 deletions)

View changed files

📝 spotipy/client.py (+26 -8)

📄 Description

I couldn't reproduce the throwing of BrokenPipeError reported in #633, but noticed that the SpotifyException that was being thrown instead had None as reason. I then noticed that both msg and reason could possibly be retrieved from the response's raw, so I created a method to do it (only if loading to json fails). I also extracted a method from the original code.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/spotipy-dev/spotipy/pull/673 **Author:** [@gustavokrieger](https://github.com/gustavokrieger) **Created:** 4/19/2021 **Status:** ❌ Closed **Base:** `master` ← **Head:** `non-json-response-proper-error-message` --- ### 📝 Commits (1) - [`4022b8d`](https://github.com/spotipy-dev/spotipy/commit/4022b8d367bfe268712ae105526c591d95b7b99b) retrieve proper message and reason when response can't be loaded to json ### 📊 Changes **1 file changed** (+26 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `spotipy/client.py` (+26 -8) </details> ### 📄 Description I couldn't reproduce the throwing of `BrokenPipeError` reported in #633, but noticed that the `SpotifyException` that was being thrown instead had `None` as `reason`. I then noticed that both `msg` and `reason` could possibly be retrieved from the response's `raw`, so I created a method to do it (only if loading to json fails). I also extracted a method from the original code. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:03:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#990
No description provided.