Phil's Python Packages


Framework free Authentication Methods for CGI scripts

Includes the following classes: The Cookie and Hidden classes use JavaScript/SHA1 hashing to avoid sending passwords as clear text.

Download Directory


Utility routines to easily make IPv4 and IPv6 TCP and UDP socket connections.

Download Directory


Follow class implements "tail -f" functionality to incrementally read text and binary files as they grow.

Download Directory


JSON Storage Access Methods is a library for storage and retrieval of JavaScript Object Notation (JSON) encoded objects.

Backends include:

Lookup methods include:

Uses 2.6+ supplied "json"; requires "simplejson" on Python 2.5. File-based storage depends on POSIX file semantics.
Requires "MySQLdb" for MySQL.
Requires "psycodb2" for PostgreSQL.

The name is a joke on IBM Mainframe data Access Methods (BDAM, BSAM, VSAM, ISAM, QSAM, BPAM). The obvious name 'jsonstore' was already taken by another package in the Python Package Index (PyPI).

Download Directory


JSONPath is an XPath-like tool for JSON. See for information on the original (JavaScript) implementation.

This version based Based on JavaScript version by Stefan Goessner at and the Perl version by Kate Rhodes at

NOTE WELL: "predicates" are evaluated using the Python eval() function, which is scary-dangerous. I made an effort to translate JavaScript syntax to Python for common cases, but it's easy to break. I regard this as a toy. The "JSAM" package (above) takes a different approach, storing JSON objects as trees in an SQL database, and executing XPath queries using SQL.

Download Directory


mimeattachement create a MIME attachment for an arbitrary file. Takes a pathname (or file pointer and filename) and returns a "message object model" object for a MIME Attachment.

Download Directory


The packet module is a front-end to the struct module. It allows the user to define a packet format, and to create a Python class to represent those packets with named attributes for each packet field.
    # demo: make an IP packet packer/unpacker

    # IP Prototype
    ipp = Prototype()
    IP = ipp.klass('IP', NETWORK)
    del ipp

    # ....

    # create an IP packet instance from bytes
    packet = IP(bytes)

Download Directory


sendmail is a package to invoke the POSIX "sendmail" program to queue e-mail, with an smtplib compatible API.

Download Directory


SPIPAT is a package that adds SNOBOL4/SPITBOL style patterns to Python as composable objects.

Patterns can be composed with other Patterns and strings using the '+' and '|' operators.

Based on a C-language translation of the GNU Ada (GNAT) package by the original creator of SPITBOL.

Download Directory