Python module for binary plist
Asked Answered
N

2

10

Is there any Python project/module working on a binary plist writer? I need one for a REST implementation I'm doing. I would like the server to send a HTTP REsponse containing a binary plist instead of json, for example. The server is Apache with mod_python and django installed. Considering adding bplist format alongside json as output formats, just inorder to simplify parsing on the iPhone, plus cutting the data transfers down.

I'm thinking of writing my own, but contributing to an existing project would be prefereable.

Thanks in advance.

Nielsen answered 16/9, 2010 at 9:16 Comment(0)
P
14

I was afraid I might have to learn SWIG, implement this myself, or switch to another language for this hobby project that involves parsing binary plists -- but after a quick pip search plist, I found biplist.

Paginate answered 21/3, 2011 at 2:32 Comment(0)
D
2

What about plistlib in the default Python distribution? It is available for all platforms since Python 2.6; before Python 2.6, it was included in the Mac version, but I guess you can simply grab the source from Python 2.6 and backport it if you really need to support older Python versions.

Update: Sorry, I've just realised that you need to support the binary plist format. In that case, use libplist, which supports both the binary and the XML format. It is written in C++, but they provide a SWIG interface definition file with which SWIG can easily generate a Python module for it. Ubuntu/Debian also includes a package called python-plist which contains precompiled binaries.

Dygal answered 16/9, 2010 at 9:52 Comment(4)
Hi Tamás, I was under the impression that plistlib only handles textual plists, not binary plists. I need to transfer a .plist in the .bplist format.Haberdashery
Sorry, I've missed that and I've updated my answer accordingly.Scalawag
Outstanding, exactly what I needed! Thanks!Haberdashery
plistlib now supports the binary format (from Python 3.4)Inadvertent

© 2022 - 2024 — McMap. All rights reserved.