Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication Flow failing due to host, port parsing #999

Open
christopherhastings opened this issue Jul 6, 2023 · 0 comments
Open

Authentication Flow failing due to host, port parsing #999

christopherhastings opened this issue Jul 6, 2023 · 0 comments
Labels

Comments

@christopherhastings
Copy link

christopherhastings commented Jul 6, 2023

Describe the bug
In the Authentication flow, when trying to set up URL parsing based on a split ":", it cannot accommodate a port, which is necessary for self-authorization. I believe the get_host_port function is having difficulties parsing. 000

Your code

from six.moves.urllib_parse import parse_qsl, urlparse

def get_host_port(netloc):
    if ":" in netloc:
        host, port = netloc.split(":", 1)
        port = int(port)
    else:
        host = netloc
        port = None


url = 'http://127.0.0.1:8080'

redirect_info = urlparse(url)
redirect_host, redirect_port = get_host_port(redirect_info.netloc)

Share a complete minimal working example.

I do not have a working example

Expected behavior

 redirect_info = urlparse(self.redirect_uri)
 redirect_host, redirect_port = get_host_port(redirect_info.netloc)

    if (
            open_browser
            and redirect_host in ("127.0.0.1", "localhost")
            and redirect_info.scheme == "http"
    ):
        # Only start a local http server if a port is specified
        if redirect_port:
            return self._get_auth_response_local_server(redirect_port)

Output
TypeError: cannot unpack non-iterable NoneType object

Environment:

  • OS: [Mac]
  • Python version [3.7.7]
  • spotipy version [2.23.0]
  • Visual Studio

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant