Spaces:
Build error
Build error
File size: 607 Bytes
f3f431f |
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 |
# THIS FILE IS RESPONSABLE FOR API CALLS
from . import urlbuilder
from requests import get, post
def call_acess_token(credentials):
endpoint = 'https://accounts.spotify.com/api/token'
data = {
'grant_type':'client_credentials'
}
headers = {
'Authorization':f'Basic {credentials}'
}
return post(url=endpoint, data=data, headers=headers)
def call_search(acess_token, args):
endpoint = urlbuilder.search_endpoint(*args)
headers = {
'Authorization':f'Bearer {acess_token}'
}
return get(url=endpoint, headers=headers)
|