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.2

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.2
File Size Uploaded
cidermill_airplay-0.1.2.tar.gz 529.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cidermill-airplay 0.1.2
File Interpreter ABI Platform
cidermill_airplay-0.1.2-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.2.tar.gz

Download URL cidermill_airplay-0.1.2.tar.gz
Size 529.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8a027650686be34b3fdbd79fca52847e5f209d57d49f83c68686ca86df058f35
BLAKE2b-256 checksum
How to use checksums
73d8bb8fa980a863d1f2b18d2e4cbb861b16e374f40bd1d7ceda41b6a16a1e78
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.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cidermill_airplay-0.1.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 765.4 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
6007293be40470485071deb29468bd98d13211500b1b745cbe6bb0a7950b6762
BLAKE2b-256 checksum
How to use checksums
6e33278909b8c963907b9ffaf95cec9e19789ef41be9be30d0456cc8112beb06
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.2 This release

2 release files

0.1.1

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