Phil's Python Packages

CGIAUTH

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

CONNECT

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

Download Directory

FOLLOW

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

Download Directory

JSAM

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

Backends include:

Lookup methods include:

NOTE:
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

JSONPath is an XPath-like tool for JSON. See http://goessner.net/articles/JsonPath/ for information on the original (JavaScript) implementation.

This version based Based on JavaScript version by Stefan Goessner at http://code.google.com/p/jsonpath/ and the Perl version by Kate Rhodes at http://github.com/masukomi/jsonpath-perl/tree/master.

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

MIMEATTACHMENT

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

PACKET

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()
    ipp.add_uint8('vhl')
    ipp.add_uint8('tos')
    ipp.add_uint16('len')
    ipp.add_uint16('id')
    ipp.add_uint16('off')
    ipp.add_uint8('ttl')
    ipp.add_uint8('p')
    ipp.add_uint16('sum')
    ipp.add_uint32('src')
    ipp.add_uint32('dst')
    IP = ipp.klass('IP', NETWORK)
    del ipp

    # ....

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

Download Directory

SENDMAIL

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

Download Directory

SPIPAT

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