mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-10-12 17:10:45 +00:00
feat: add types to args
This commit is contained in:
1 parent
9119b6a070
commit
efc3474e27
7 files changed
+419
-284
No files matched your search
+5
-2
@@ -1,9 +1,12 @@
|
||||
import base64
|
||||
from typing import Union
|
||||
|
||||
import requests
|
||||
|
||||
from spotipy import Spotify
|
||||
|
||||
def get_spotify_playlist(spotify_object, playlist_name, username):
|
||||
|
||||
def get_spotify_playlist(spotify_object: Spotify, playlist_name: str, username: str):
|
||||
playlists = spotify_object.user_playlists(username)
|
||||
while playlists:
|
||||
for item in playlists['items']:
|
||||
@@ -12,5 +15,5 @@ def get_spotify_playlist(spotify_object, playlist_name, username):
|
||||
playlists = spotify_object.next(playlists)
|
||||
|
||||
|
||||
def get_as_base64(url):
|
||||
def get_as_base64(url: Union[str, bytes]) -> str:
|
||||
return base64.b64encode(requests.get(url).content).decode("utf-8")
|
||||
@@ -13,7 +13,7 @@ patch = mock.patch
|
||||
DEFAULT = mock.DEFAULT
|
||||
|
||||
|
||||
def _make_fake_token(expires_at, expires_in, scope):
|
||||
def _make_fake_token(expires_at: int, expires_in: int, scope: str):
|
||||
return dict(
|
||||
expires_at=expires_at,
|
||||
expires_in=expires_in,
|
||||
|
||||
Reference in new issue
Block a user