Skip to main content

cidermill-airplay (Python)

Python bindings for cidermill-airplay, a sans-io AirPlay 2 implementation in Rust: the RTSP/HTTP codec, HAP pairing on both sides, the ChaCha20-Poly1305 framing and /info parsing. Nothing here opens a socket; you own the I/O.

import socket
import cidermill_airplay as ap

def post(sock, path, body):
    request = ap.Request("POST", path, ap.Protocol.RTSP, body)
    request.set_header("X-Apple-HKP", "3")
    sock.sendall(request.encode())
    decoder = ap.Decoder()
    while (response := decoder.next_response()) is None:
        decoder.push(sock.recv(65536))
    return response.body()

credentials = ap.HapCredentials.parse(open("credentials.txt").read().strip())
with socket.create_connection(("192.0.2.10", 7000)) as sock:
    verify = ap.PairVerify(credentials)
    step = verify.handle(post(sock, "/pair-verify", verify.start()))
    while step.send is not None:
        step = verify.handle(post(sock, "/pair-verify", step.send))
    channel = step.keys.transport()  # seal requests, push and open replies from here on
Codec Request, Response, Decoder, Protocol, Tlv8, DeviceInfo, PlaybackInfo
Pairing, controller PairSetup (PIN, transient), PairVerify, PairingStep, TransientStyle
Pairing, accessory PairSetupServer, PairVerifyServer, PairingOutcome, PinGate
Keys and framing SessionKeys, EncryptedTransport
Credentials HapCredentials, LegacyCredentials (pyatv's storage strings)
Errors AirPlayException and subclasses; PairingError.code, StatusError.code/.path/.reason, PairVerifyRefusedError, DecryptError

A receiver shares one PinGate across every connection's PairSetupServer, so PIN guesses are limited per source address (pass source=) with a receiver-wide net behind it. Not wrapped: the blocking control channel, audio and mirroring.

Building and testing

maturin develop --release                    # into the active virtualenv
python -m unittest discover -s tests -v
maturin build --release                      # a wheel

License: GPL-3.0-or-later, the same as the core (see LICENSE).

Metadata

Release files for cidermill-airplay 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cidermill-airplay 0.1.1
File Size Uploaded
cidermill_airplay-0.1.1.tar.gz 526.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cidermill-airplay 0.1.1
File Interpreter ABI Platform
cidermill_airplay-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details

Total release size: 1.3 MB

Release files / cidermill_airplay-0.1.1.tar.gz

Download URL cidermill_airplay-0.1.1.tar.gz
Size 526.3 kB
Tags Source
SHA-256 checksum
How to use checksums
54dd012291d0d779317d32969e689d0c76d63d137d9d67d35d57fbd248d40d76
BLAKE2b-256 checksum
How to use checksums
84a8827ba325e562b72986c363f94c6bf34e67335378167ac29f0c3236648ffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / cidermill_airplay-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cidermill_airplay-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 765.2 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
ec9ca8855d0ff849b04c543a3f6587c62b7c83d50cde857ecccad8f0882dc3bd
BLAKE2b-256 checksum
How to use checksums
aba2aa1371751ce2bb8a94b058a3f0cf62c4b2a9cb3961eb3f91287a6507f429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page