PyKodi
An async python interface for Kodi over JSON-RPC. This is mostly designed to integrate with HomeAssistant. If you have other needs, there might be better packages available.
Installation
You can install PyKodi from PyPI:
pip3 install pykodi
Python 3.11 and above are supported.
How to use
from pykodi import get_kodi_connection, Kodi
kc = get_kodi_connection(<host>, <port>, <ws_port>, <username>, <password>, <ssl>, <timeout>, <session>)
# if ws_port is None the connection will be over HTTP, otherwise over WebSocket.
# ssl defaults to False (only relevant if you have a proxy), timeout to 5 (seconds)
# session is generated if not passed in
# you can also pass in your own session
await kc.connect()
kodi = Kodi(kc)
await kodi.ping()
properties = await kodi.get_application_properties(["name", "version"])
await kodi.play()
await kodi.volume_up()
await kodi.pause()
...
# over WebSocket you can subscribe to Kodi notifications
def on_play(sender, data):
print(data["item"])
unsubscribe = kc.subscribe("Player.OnPlay", on_play)
...
unsubscribe()
# and get a call when the connection is lost, but not after close()
def on_disconnect(error):
print("Connection to Kodi lost:", error) # usually None, a network drop included
remove = kc.on_disconnect(on_disconnect)
...
remove()
Stream and HDR details
players = await kodi.get_players()
info = await kodi.get_stream_info(players[0])
info["currentvideostream"] # {"codec": "hevc", "width": 3840, "height": 2160, ...}
info["infolabels"]["VideoPlayer.HdrType"] # "dolbyvision", "hdr10", "hlg" or "" ("hdr10plus" from Kodi 22)
info["infolabels"]["System.ScreenResolution"]
info["hdrhints"] # ["dolbyvision", "hdr10"], taken from the file name
The info labels are returned as Kodi reports them. Labels that the running Kodi version does not know are empty strings. hdrhints lists the HDR formats named in the file name, because Kodi 21 reports HDR10+ as hdr10 and does not report the HDR10 base layer of a Dolby Vision stream.
Metadata
Release files for pykodi 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pykodi-0.4.0.tar.gz | 23.7 kB | With provenance | Details for pykodi-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pykodi-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for pykodi-0.4.0-py3-none-any.whl |
Total release size: 34.8 kB
Release files / pykodi-0.4.0.tar.gz
| Download URL | pykodi-0.4.0.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29556bc631dfcff4a2bf6df821c7640724b022393035861060468552fbe108b1
|
|
BLAKE2b-256 checksum How to use checksums |
5491129d00f9df444171f04f4c24677aaab330ae6572d4061358bc94d84164a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / pykodi-0.4.0-py3-none-any.whl
| Download URL | pykodi-0.4.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0a92fcf797a40bbb6646d41bb1bfefc2f27314e91be5f9d37c5b2a018969877
|
|
BLAKE2b-256 checksum How to use checksums |
b412cb9fd81e572b31171def81cfe6c0febec35d54564842e6f7fbbd1ccb5959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for pykodi 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pykodi-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.