python-3.xterminalspotipyoraclelinux

Get spotipy redirect URL from oracle linux terminal


I wanted to deploy my script that uses module spotipy to oracle linux vm. I'm almost done, however whenever script is used for the first time, spotipy redirects me to URL. And I need to type it in, so it goes on, but on vm I have no browser, so I have no idea how can I get this URL

The error: raise SpotifyOauthError( spotipy.oauth2.SpotifyOauthError: error: invalid_request, error_description: code must be supplied

URL that I am redirected to starts https://example.com/ It's the link that I have in my dashboard in spotify developer account itself. However, it must have some different parameters, some code I guess. I tried typing https://example.com?code=my-client-id and https://example.com?code=my-client-secret but they aren't working (client-id and client-secret from my spotify dashboard).

I also wanted to install tcpflow on my vm to monitor http requests. But using sudo yum install tcpflow answers with Error: Unable to find a match: tcpflow.

For this reason, I can not start using my app. If anyone knows how to check URL from terminal or knows how spotipy redirect link is formatted, I would be really grateful.

I'm using Python 3.9.13 and oracle-linux 8.


Solution

  • Well, turns out there is an argument open_browser for spotipy.oauth2.SpotifyOAuth() . It tells spotipy just to print URL in terminal instead of openning in web browser.

    Super glad I found this question:

    Why does the 'couldn't read cache at: .cache-<My Username> ' warning appear and the code run indefinitely when authenticating in Spotipy?