[PR #461] [MERGED] Print -> Logging #908

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

📋 Pull Request Information

Original PR: https://github.com/spotipy-dev/spotipy/pull/461
Author: @Beahmer89
Created: 4/2/2020
Status: Merged
Merged: 4/3/2020
Merged by: @stephanebruckert

Base: masterHead: logging


📝 Commits (7)

  • 636258e Logging - add logging lines to client and remove trace
  • ceb9167 Logging - add logging lines to oauth
  • 0bbff4a Logging - add logging lines to util
  • 8a8c7e0 Logging - Modify examples to show logging works as expected
  • 74c3621 Bug - fixing issue with default port that results in permissions issue
  • fd427de Logging - PR Feedback: bring back some info into debug logging and lowercase logger global var
  • 568d5c2 Logging - Update changelog

📊 Changes

15 files changed (+303 additions, -288 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 CONTRIBUTING.md (+2 -2)
📝 examples/add_a_saved_album.py (+30 -21)
📝 examples/add_a_saved_track.py (+31 -21)
📝 examples/add_tracks_to_playlist.py (+32 -21)
📝 examples/artist_albums.py (+25 -15)
📝 examples/artist_discography.py (+28 -22)
📝 examples/artist_recommendations.py (+26 -15)
📝 examples/change_playlist_details.py (+47 -35)
📝 examples/create_playlist.py (+33 -24)
examples/errors.py (+0 -19)
examples/test_request_timeout.py (+0 -14)
📝 spotipy/client.py (+22 -43)
📝 spotipy/oauth2.py (+21 -32)
📝 spotipy/util.py (+5 -4)

📄 Description

Purpose of PR
This is related to Issue 84. Currently spotipy is using print statements in order to provide users with information about what is happening in the code. It is much more effective to use the logging library in python so that users are able to customize the output and see the logging within their app thats using spotipy.

What was Done

  • Replaced all print statements with correct logging level
    • Removed trace attribute as it is no longer needed
  • In order to test this I modified a couple of the examples to use logging and argparse
    • Not entirely sure if you would like the approach so I only modified a part of the examples. Would like to put up another PR with making all the examples consistent
  • Removed examples of errors and error handling. These are not needed in my opinion as there are tests that cover this.
  • BUG - Noticed with the addition of automatically handling the redirect that I was getting a socket.error: [Errno 13] Permission denied (even when I changed my app to use default port 80)
    • Saw in stackoverflow that you can just run on a higher port number.
    • changed default port number from 80 -> 8080
      • updated CONTRIBUTING.md

🔄 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/461 **Author:** [@Beahmer89](https://github.com/Beahmer89) **Created:** 4/2/2020 **Status:** ✅ Merged **Merged:** 4/3/2020 **Merged by:** [@stephanebruckert](https://github.com/stephanebruckert) **Base:** `master` ← **Head:** `logging` --- ### 📝 Commits (7) - [`636258e`](https://github.com/spotipy-dev/spotipy/commit/636258ee8a431e6a10db3c95b1ea075d5492338a) Logging - add logging lines to client and remove trace - [`ceb9167`](https://github.com/spotipy-dev/spotipy/commit/ceb916721ac21a8b4061bbdb8c8e88efe5902650) Logging - add logging lines to oauth - [`0bbff4a`](https://github.com/spotipy-dev/spotipy/commit/0bbff4add109fb0db6723b6f44c0fc1775fc8bfa) Logging - add logging lines to util - [`8a8c7e0`](https://github.com/spotipy-dev/spotipy/commit/8a8c7e00892c8bb86927b7fa94655e61dae9cc89) Logging - Modify examples to show logging works as expected - [`74c3621`](https://github.com/spotipy-dev/spotipy/commit/74c3621c03d40de45f26f413088771d73c316e17) Bug - fixing issue with default port that results in permissions issue - [`fd427de`](https://github.com/spotipy-dev/spotipy/commit/fd427deb58a7767751f125fbd33e13a6b3f25556) Logging - PR Feedback: bring back some info into debug logging and lowercase logger global var - [`568d5c2`](https://github.com/spotipy-dev/spotipy/commit/568d5c2424e869d22bef5991a6f8f57ed3dc645b) Logging - Update changelog ### 📊 Changes **15 files changed** (+303 additions, -288 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `CONTRIBUTING.md` (+2 -2) 📝 `examples/add_a_saved_album.py` (+30 -21) 📝 `examples/add_a_saved_track.py` (+31 -21) 📝 `examples/add_tracks_to_playlist.py` (+32 -21) 📝 `examples/artist_albums.py` (+25 -15) 📝 `examples/artist_discography.py` (+28 -22) 📝 `examples/artist_recommendations.py` (+26 -15) 📝 `examples/change_playlist_details.py` (+47 -35) 📝 `examples/create_playlist.py` (+33 -24) ➖ `examples/errors.py` (+0 -19) ➖ `examples/test_request_timeout.py` (+0 -14) 📝 `spotipy/client.py` (+22 -43) 📝 `spotipy/oauth2.py` (+21 -32) 📝 `spotipy/util.py` (+5 -4) </details> ### 📄 Description **Purpose of PR** This is related to [Issue 84](https://github.com/plamere/spotipy/issues/84). Currently spotipy is using print statements in order to provide users with information about what is happening in the code. It is much more effective to use the logging library in python so that users are able to customize the output and see the logging within their app thats using spotipy. **What was Done** - Replaced all print statements with correct logging level - Removed `trace` attribute as it is no longer needed - In order to test this I modified a couple of the examples to use `logging` and `argparse` - Not entirely sure if you would like the approach so I only modified a part of the examples. Would like to put up another PR with making all the examples consistent - Removed examples of errors and error handling. These are not needed in my opinion as there are tests that cover this. - **BUG** - Noticed with the addition of automatically handling the redirect that I was getting a `socket.error: [Errno 13] Permission denied` (even when I changed my app to use default port 80) - Saw in [stackoverflow](https://stackoverflow.com/questions/24001147/python-bind-socket-error-errno-13-permission-denied) that you can just run on a higher port number. - changed default port number from 80 -> 8080 - updated CONTRIBUTING.md --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:02:32 +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#908
No description provided.