How to use the tekore._client.chunked.chunked function in tekore

To help you get started, we’ve selected a few tekore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felix-hilden / spotipy / tests / client / full.py View on Github external
def test_argument_chain(self):
        func = MagicMock(side_effect=[0, 1])
        slf = mock_spotify()

        dec = chunked('a', 1, 10, return_last, chain='ch', chain_pos=2)(func)
        r = dec(slf, list(range(20)), ch=None)
        func.assert_called_with(slf, list(range(10, 20)), ch=0)
        assert r == 1
github felix-hilden / spotipy / tests / client / full.py View on Github external
def test_reverse_when_rev_argument_specified(self):
        func = MagicMock(side_effect=[0, 1])
        slf = mock_spotify()

        dec = chunked('a', 1, 10, return_last, reverse='rev', reverse_pos=2)(func)
        r = dec(slf, list(range(20)), rev=1)
        func.assert_called_with(slf, list(range(10)), rev=1)
        assert r == 1
github felix-hilden / spotipy / tests / client / full.py View on Github external
def test_chunked_as_kwarg(self):
        func = MagicMock(side_effect=[0, 1])

        dec = chunked('a', 2, 10, return_last)(func)
        r = dec(mock_spotify(), 0, a=list(range(20)))
        assert r == 1
github felix-hilden / spotipy / tekore / _client / api / follow.py View on Github external
    @chunked('user_ids', 1, 50, join_lists)
    @send_and_process(nothing)
    def users_is_following(self, user_ids: list) -> List[bool]:
        """
        Check if current user follows users.

        Parameters
        ----------
        user_ids
            list of user IDs, max 50 without chunking

        Returns
        -------
        List[bool]
            follow statuses in the same order that the user IDs were given
        """
        return self._get(
github felix-hilden / spotipy / tekore / _client / api / track.py View on Github external
    @chunked('track_ids', 1, 50, join_lists)
    @send_and_process(model_list(FullTrack, 'tracks'))
    def tracks(
            self,
            track_ids: list,
            market: str = None
    ) -> ModelList[FullTrack]:
        """
        Get information for multiple tracks.

        Parameters
        ----------
        track_ids
            the track IDs, max 50 without chunking
        market
            an ISO 3166-1 alpha-2 country code or 'from_token'
        """
github felix-hilden / spotipy / tekore / _client / api / library.py View on Github external
    @chunked('album_ids', 1, 50, return_none)
    @send_and_process(nothing)
    def saved_albums_delete(self, album_ids: list) -> None:
        """
        Remove albums for current user.

        Parameters
        ----------
        album_ids
            list of album IDs, max 50 without chunking
        """
        return self._delete('me/albums?ids=' + ','.join(album_ids))
github felix-hilden / spotipy / tekore / _client / api / follow.py View on Github external
    @chunked('artist_ids', 1, 50, return_none)
    @send_and_process(nothing)
    def artists_unfollow(self, artist_ids: list) -> None:
        """
        Unfollow artists as current user.

        Parameters
        ----------
        artist_ids
            list of artist IDs, max 50 without chunking
        """
        return self._delete('me/following', type='artist', ids=','.join(artist_ids))
github felix-hilden / spotipy / tekore / _client / api / library.py View on Github external
    @chunked('show_ids', 1, 50, return_none)
    @send_and_process(nothing)
    def saved_shows_delete(self, show_ids: list, market: str = None) -> None:
        """
        Remove shows for current user.

        Parameters
        ----------
        show_ids
            list of show IDs, max 50 without chunking
        market
            an ISO 3166-1 alpha-2 country code, only remove shows that are
            available in the specified market, overrided by token's country
        """
        return self._delete('me/shows/?ids=' + ','.join(show_ids), market=market)
github felix-hilden / spotipy / tekore / _client / api / library.py View on Github external
    @chunked('track_ids', 1, 50, return_none)
    @send_and_process(nothing)
    def saved_tracks_add(self, track_ids: list) -> None:
        """
        Save tracks for current user.

        Parameters
        ----------
        track_ids
            list of track IDs, max 50 without chunking
        """
        return self._put('me/tracks/?ids=' + ','.join(track_ids))