(self, url: str, params: dict = None)
return {}
Perform the specified API request.
Perform the specified API request.
Perform the specified API request .
def get(self, url: str, params: dict = None) -> dict:
        """Perform the specified API request."""
        url = f"https://api.jamendo.com/v3.0/{url}"
        if not params:
            params = {}
        params["client_id"] = self.client_id
        try:
            with closing(self.session.get(url, params=params)) as res:
                logging.debug(f"Requested {res.url}")
                res.raise_for_status()
                return res.json()
        except Exception as e:
            if isinstance(e, requests.HTTPError) and e.response.status_code == 401:
                logging.error('Invalid "client_id" used for Jamendo authentication!')
            else:
                logging.error(f"Jamendo API request failed: {e}")
        return {}
def get ( self , url : str , params : dict = None ) -> dict : url = f"https://api.jamendo.com/v3.0/{url}" if not params : params = { } params [ "client_id" ] = self . client_id try : with closing ( self . session . get ( url , params = params ) ) as res : logging . debug ( f"Requested {res.url}" ) res . raise_for_status ( ) return res . json ( ) except Exception as e : if isinstance ( e , requests . HTTPError ) and e . response . status_code == 401 : logging . error ( 'Invalid "client_id" used for Jamendo authentication!' ) else : logging . error ( f"Jamendo API request failed: {e}" ) return { }