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

Add connect api endpoint #182

Merged
merged 2 commits into from
Sep 17, 2017
Merged

Conversation

happyleavesaoc
Copy link
Contributor

@tgurr
Copy link

tgurr commented Apr 27, 2017

As discussed in home-assistant/core#7286 would it be possible to get this feature integerated and a new spotipy version released? This would ease adoption for distributions. Personally I can say I've tested spotipy (in combination with home assistant and different hardware, namely an Amazon FireTV and a Google Nexus 4 with the official Android Spotify app) with this pull request and it works really well so I'd love to see this feature getting merged.

@durzo
Copy link

durzo commented Jul 20, 2017

I had to make a small fix to this PR in order to get it working.

_append_device_id adds "&device_id=%s" onto the path but this breaks if there are no existing query strings (missing "?"). causing spotify API to return 404

This fixed for me:

    def _append_device_id(self, path, device_id):
        ''' Append device ID to API path.

            Parameters:
                - device_id - device id to append
        '''
        if device_id:
            if '?' in path:
                path += "&device_id=%s" % device_id
            else:
                path += "?device=id=%s" % device_id
        return path

@jhaucke
Copy link

jhaucke commented Aug 17, 2017

For those who wonder why changing the current device not working correctly:
With "?device_id=%s" instead of "?device=id=%s" it will work even better ;)

@happyleavesaoc
Copy link
Contributor Author

happyleavesaoc commented Aug 18, 2017

@durzo @jhaucke updated PR with that fix. Thanks!

@lenisko
Copy link

lenisko commented Sep 4, 2017

@plamere could you hit accept ;-) ?

@plamere
Copy link
Collaborator

plamere commented Sep 17, 2017

Nice PR, thanks!

@plamere plamere merged commit d0143f7 into spotipy-dev:master Sep 17, 2017
@happyleavesaoc
Copy link
Contributor Author

Thanks for the merge!

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

Successfully merging this pull request may close these issues.

6 participants