Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python module for binary plist

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.

like image 283
George André Avatar asked Sep 16 '10 09:09

George André


2 Answers

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.

like image 137
Ed Brannin Avatar answered Nov 03 '22 18:11

Ed Brannin


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.

like image 31
Tamás Avatar answered Nov 03 '22 20:11

Tamás