16 lines
508 B
Python
16 lines
508 B
Python
import requests
|
|
|
|
|
|
class JellyfinAPI:
|
|
def __init__(self, host: str, **config):
|
|
self.host = host
|
|
self.config = config
|
|
|
|
def api(self, method: str, path: str, params: dict = None):
|
|
_params = {"api_key": self.config["api_key"]}
|
|
if params is not None:
|
|
params.update(_params)
|
|
else:
|
|
params = _params
|
|
url = f"https://{self.host}/{path}"
|
|
return requests.request(method, url, params=params, verify=self.config["verify_ssl"]).json() |