Skip to main content

A Possible Official Python SDK for Jellyfin.

Project description

jellyfin-sdk-python


Logo Banner

A Possible Official Python SDK for Jellyfin.

Warning: This project is under active development, so API changes may occur.

This project is mainly inspired by good python library like these:

Main unique features:

  • Supports targeting the Jellyfin server version to maintain compatibility.
  • It is possible to access multiple servers with different versions.
  • Allows gradually increasing the depth of access to more primitive objectives.
  • Works like AWS CDK Constructs Level, more abstraction, more simple.

Install

pip install jellyfin-sdk

or

uv add jellyfin-sdk

Usage

Drop-in replacement for jellyfin-apiclient-python

This library inject the old legacy (almost not maintained) for help migration:

# from
from jellyfin_apiclient_python import JellyfinClient
from jellyfin_apiclient_python.api import API

# to 
from jellyfin.legacy import JellyfinClient
from jellyfin.legacy.api import API

Login

Let's start with login, most cases you only need do something simple:

import os

os.environ["JELLYFIN_URL"] = "https://jellyfin.example.com"
os.environ["JELLYFIN_API_KEY"] = "MY_TOKEN"

Legacy (jellyfin-apiclient-python)

from jellyfin.legacy import JellyfinClient
client = JellyfinClient()
client.authenticate(
    {"Servers": [{
        "AccessToken": os.getenv("JELLYFIN_API_KEY"), 
        "address": os.getenv("JELLYFIN_URL")
    }]}, 
    discover=False
)
system_info = client.jellyfin.get_system_info()

print(system_info.get("Version"), system_info.get("ServerName"))

Generated Binding with OpenAPI Specification

from jellyfin.generated.api_10_10 import Configuration, ApiClient, SystemApi

client = ApiClient(
    Configuration(host = os.getenv("JELLYFIN_URL")), 
    header_name='X-Emby-Token', 
    header_value=os.getenv("JELLYFIN_API_KEY")
)
system_info = SystemApi(client).get_system_info()

print(system_info.version, system_info.server_name)

Lean optimized access

import jellyfin

api = jellyfin.api(os.getenv("JELLYFIN_URL"), os.getenv("JELLYFIN_API_KEY"))

print(api.system.info.version, api.system.info.server_name)

Jellyfin Server API Version

This is important because when a new API version come to live breaking changes can broke the entire project, to avoid this problem is possible to set a API Target, like in Android:

from jellyfin.api import Version
import jellyfin

# this will use the default which is the lastest stable
jellyfin.api(os.getenv("JELLYFIN_URL"), os.getenv("JELLYFIN_API_KEY"))

# now let's test the new API (version 10.11) for breaking changes in same endpoint
jellyfin.api(os.getenv("JELLYFIN_URL"), os.getenv("JELLYFIN_API_KEY"), Version.V10_11)

# but keep simple
jellyfin.api(os.getenv("JELLYFIN_URL"), os.getenv("JELLYFIN_API_KEY"), '10.11')

# let's test a wrong version
jellyfin.api(os.getenv("JELLYFIN_URL"), os.getenv("JELLYFIN_API_KEY"), '99')

Supported Jellyfin Versions

SDK Version Jellyfin API Target
0.1.x 10.10.x-10.11.x

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jellyfin_sdk-0.1.1.tar.gz (779.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jellyfin_sdk-0.1.1-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file jellyfin_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: jellyfin_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 779.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.13

File hashes

Hashes for jellyfin_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f094e3b83fdcc89f2db2191de83f495fa77192e4d5891486f8a6f3bff73c09e4
MD5 6625691a495711e9a320718350c390c0
BLAKE2b-256 37db3f637296ab7761a8ffd622031ea14c442323beaa7a2efafbcf2b7d5fe75c

See more details on using hashes here.

File details

Details for the file jellyfin_sdk-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jellyfin_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9892fa200ae1db0789c3a1aa7347c8fdc3d590d477563a1dbd43193d0278ff5
MD5 880f0f5ecd8f987fb09161606d3cda93
BLAKE2b-256 0d2e24b3ea5b98fa2879758ef2cccc589d1d0338baabce1ca697ad5067442fb0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page