From fa57f6d3e2c50c2d70c1a2b6d91c40d559d4b0dd Mon Sep 17 00:00:00 2001 From: KnallbertLp Date: Sat, 30 Jan 2021 22:10:30 +0100 Subject: [PATCH] Removed requirement for examples/app.py to specify port multiple times (only SPOTIPY_REDIRECT_URI needs to contain the port) (#636) --- CHANGELOG.md | 1 + examples/app.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ebf989..93fc834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changed docs for `search` to mention that you can provide multiple types to search for - The query parameters of requests are now logged - Deprecate specifing `cache_path` or `username` directly to `SpotifyOAuth`, `SpotifyPKCE`, and `SpotifyImplicitGrant` constructors, instead directing users to use the `CacheFileHandler` cache handler +- Removed requirement for examples/app.py to specify port multiple times (only SPOTIPY_REDIRECT_URI needs to contain the port) ### Added diff --git a/examples/app.py b/examples/app.py index 727dfba..aa6ad19 100644 --- a/examples/app.py +++ b/examples/app.py @@ -18,7 +18,7 @@ Prerequisites Run app.py - python3 -m flask run --port=8080 + python3 app.py OR python3 -m flask run NOTE: If receiving "port already in use" error, try other ports: 5000, 8090, 8888, etc... (will need to be updated in your Spotify app and SPOTIPY_REDIRECT_URI variable) """ @@ -123,4 +123,5 @@ Following lines allow application to be run more conveniently with (Also includes directive to leverage pythons threading capacity.) ''' if __name__ == '__main__': - app.run(threaded=True, port=int(os.environ.get("PORT", 8080))) + app.run(threaded=True, port=int(os.environ.get("PORT", + os.environ.get("SPOTIPY_REDIRECT_URI", 8080).split(":")[-1])))