How to use the tekore._auth.scope 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 / tekore / _client / api / player / view.py View on Github external
    @scopes([scope.user_read_recently_played])
    @send_and_process(single(PlayHistoryPaging))
    @maximise_limit(50)
    def playback_recently_played(
            self,
            limit: int = 20,
            after: int = None,
            before: int = None
    ) -> PlayHistoryPaging:
        """
        Get tracks from the current user's recently played tracks.

        Only ``after`` or ``before`` should be specified at one time.

        Parameters
        ----------
        limit
github felix-hilden / spotipy / tekore / _client / api / personalisation.py View on Github external
    @scopes([scope.user_top_read])
    @send_and_process(single(FullTrackPaging))
    @maximise_limit(50)
    def current_user_top_tracks(
            self,
            time_range: str = 'medium_term',
            limit: int = 20,
            offset: int = 0
    ) -> FullTrackPaging:
        """
        Get the current user's top tracks.

        Parameters
        ----------
        time_range
            Over what time frame are the affinities computed.
            Valid-values: short_term, medium_term, long_term
github felix-hilden / spotipy / tekore / _client / api / playlist / __init__.py View on Github external
    @scopes([scope.playlist_modify_public], [scope.playlist_modify_private])
    @deprecated('2.0', '3.0', 'playlist_remove')
    def playlist_tracks_remove(
            self,
            playlist_id: str,
            track_ids: list,
            snapshot_id: str = None
    ) -> str:
        """
        Remove all occurrences of tracks from a playlist.

        Note that when chunked, ``snapshot_id`` is not updated between requests.

        Parameters
        ----------
        playlist_id
            playlist ID
github felix-hilden / spotipy / tekore / _client / api / follow.py View on Github external
    @scopes(optional=[scope.playlist_read_private])
    @chunked('user_ids', 2, 5, join_lists)
    @send_and_process(nothing)
    def playlist_is_following(self, playlist_id: str, user_ids: list) -> List[bool]:
        """
        Check if users are following a playlist.

        Parameters
        ----------
        playlist_id
            playlist ID
        user_ids
            list of user IDs, max 5 without chunking

        Returns
        -------
        List[bool]
github felix-hilden / spotipy / tekore / _client / api / playlist / __init__.py View on Github external
    @scopes([scope.playlist_modify_public], [scope.playlist_modify_private])
    @deprecated('2.0', '3.0', 'playlist_remove_occurrences')
    def playlist_tracks_remove_occurrences(
            self,
            playlist_id: str,
            track_refs: List[Tuple[str, int]],
            snapshot_id: str = None
    ) -> str:
        """
        Remove tracks from a playlist by track ID and position.

        Parameters
        ----------
        playlist_id
            playlist ID
        track_refs
            a list of tuples containing the ID and index of tracks to remove
github felix-hilden / spotipy / tekore / _client / api / playlist / modify.py View on Github external
    @scopes([scope.playlist_modify_public], [scope.playlist_modify_private])
    @send_and_process(nothing)
    def playlist_cover_image_upload(self, playlist_id: str, image: str) -> None:
        """
        Upload a custom playlist cover image.

        Parameters
        ----------
        playlist_id
            playlist ID
        image
            image data as a base64-encoded string
        """
        return Request(
            method='PUT',
            url=build_url(f'playlists/{playlist_id}/images'),
            headers=self._create_headers(content_type='image/jpeg'),
github felix-hilden / spotipy / tekore / _client / api / player / view.py View on Github external
        [scope.user_read_playback_state, scope.user_read_currently_playing],
        [scope.user_read_playback_state, scope.user_read_currently_playing]
    )
    @send_and_process(single(CurrentlyPlaying))
    def playback_currently_playing(
            self,
            market: str = None,
            tracks_only: bool = False
    ) -> CurrentlyPlaying:
        """
        Get user's currently playing track.

        Only one of the scopes above is required.

        Parameters
        ----------
        market
github felix-hilden / spotipy / tekore / _client / api / playlist / __init__.py View on Github external
    @scopes([scope.playlist_modify_public], [scope.playlist_modify_private])
    @deprecated('2.0', '3.0', 'playlist_add')
    def playlist_tracks_add(
            self,
            playlist_id: str,
            track_ids: list,
            position: int = None
    ) -> str:
        """
        Add tracks to a playlist.

        Parameters
        ----------
        playlist_id
            playlist ID
        track_ids
            list of track IDs, max 100 without chunking
github felix-hilden / spotipy / tekore / _client / api / follow.py View on Github external
    @scopes([scope.user_follow_modify])
    @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 / __init__.py View on Github external
config_to_file,
    MissingConfigurationWarning,
)

__version__ = _read_version_file()

# Change the module of classes to hide module structure
# and fix Sphinx base class links
_classes = [
    Spotify,
    Credentials,
    Token,
    AccessToken,
    RefreshingCredentials,
    RefreshingToken,
    scope,
    Scope,
    HTTPError,
    ClientError,
    ServerError,
    BadRequest,
    Unauthorised,
    Forbidden,
    NotFound,
    TooManyRequests,
    InternalServerError,
    BadGateway,
    ServiceUnavailable,
    ConversionError,
    IdentifierType,
    Sender,
    SyncSender,