/
user.py
33 lines (27 loc) · 896 Bytes
/
user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from ..base import SpotifyBase
from ..decor import send_and_process, scopes
from ..process import single
from tekore._auth import scope
from tekore.model import PublicUser, PrivateUser
class SpotifyUser(SpotifyBase):
"""User API endpoints."""
@scopes()
@send_and_process(single(PublicUser))
def user(self, user_id: str) -> PublicUser:
"""
Get a user's profile.
Parameters
----------
user_id
user ID
"""
return self._get('users/' + user_id)
@scopes(optional=[scope.user_read_private, scope.user_read_email])
@send_and_process(single(PrivateUser))
def current_user(self) -> PrivateUser:
"""
Get current user's profile.
The user-read-private scope allows the user's country and
product subscription level to be returned.
"""
return self._get('me/')