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

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.0
File Size Uploaded
cidermill_airplay-0.1.0.tar.gz 524.7 kB Details

Built distribution (wheel)

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

Download URL cidermill_airplay-0.1.0.tar.gz
Size 524.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0fe25e54590dadcf4ea91b79171ef3b245aa667eb9b61f843470ea60ee577f1d
BLAKE2b-256 checksum
How to use checksums
d0b2ea242176e2311d3c330910243867e6b8151066eac4a43833ffa53291fb34
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.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cidermill_airplay-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 765.8 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
70c4633eec3abaebe650f8495af935efb371c24ce133beaed34ed885a28e21b4
BLAKE2b-256 checksum
How to use checksums
12fbac068eb918d0483289cb1bb55717e65d090d7a9a6049d92007161558fcf5
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.0 This release

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