stlist

stlist is a library for reading/writing binary plists.


License
BSD-3-Clause
Install
pip install stlist==1.0.0

Documentation

stlist

stlist is a binary plist parser/generator for Python.

Forked from biplist

About

Binary Property List (plist) files provide a faster and smaller serialization format for property lists on OS X. This is a library for generating binary plists which can be read by OS X, iOS, or other clients.

API

The API models the plistlib API, and will call through to plistlib when XML serialization or deserialization is required.

To generate plists with UID values, wrap the values with the Uid object. The value must be an int.

To generate plists with NSData/CFData values, wrap the values with the Data object. The value must be a string.

Date values can only be datetime.datetime objects.

The exceptions InvalidPlistException and NotBinaryPlistException may be thrown to indicate that the data cannot be serialized or deserialized as a binary plist.

Installation

To install the latest release version:

pip install stlist

Examples

Plist parsing example:

import stlist

try:
    plist = stlist.readPlist("example.plist")
except (stlist.InvalidPlistException, stlist.NotBinaryPlistException) as e:
    print(f"Not a plist: {e}")
else:
    print(plist)

Plist generation example:

import stlist

from datetime import datetime
plist = {
    'aKey': 'aValue',
    '0': 1.322,
    'now': datetime.now(),
    'list': [1,2,3],
    'tuple': ('a','b','c'),
}
stlist.writePlist(plist, "example.plist")