Skip to content

Add connect api endpoint#182

Merged
plamere merged 2 commits intospotipy-dev:masterfrom
happyleavesaoc:connect-api
Sep 17, 2017
Merged

Add connect api endpoint#182
plamere merged 2 commits intospotipy-dev:masterfrom
happyleavesaoc:connect-api

Conversation

@happyleavesaoc
Copy link
Copy Markdown
Contributor

@tgurr
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Contributor Author

happyleavesaoc commented Aug 18, 2017

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

@lenisko
Copy link
Copy Markdown

lenisko commented Sep 4, 2017

@plamere could you hit accept ;-) ?

@plamere
Copy link
Copy Markdown
Collaborator

plamere commented Sep 17, 2017

Nice PR, thanks!

@plamere plamere merged commit d0143f7 into spotipy-dev:master Sep 17, 2017
@happyleavesaoc
Copy link
Copy Markdown
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