Fiction

Fiction L
A Fake Internet Presence,
since 1994

 Home
 TidBits
 BLong
   Source
     GBuffy
     Mutt
     ClearSilver
     Python
     PyApache
   PalmOS Tools  

Brandon's Program Archive: Python

Python is a pretty neato scripting language with a myriad of useful classes that allow you to easily prototype just about anything you might need to. It's a bit slower than some of the alternatives, but the C interface is pretty clean so you can move code to C with relative ease when performance becomes necessary. We used Python extensively at eGroups, and there is still some remaining in the current Yahoo! Groups.

Here are some useful Python classes/modules that I've used from time to time:

For the full listing, you can go here.
VirtualBrowser

The VirtualBrowser is a scriptable browser. You can use it to test web pages, or from scripts that need access to web pages. It supports cookies, HTTP Basic Authentication, HTTP POST and none-HTTP URLs. This version is using timeoutsocket.py from Timothy O'Malley, as well as a modified version of the Cookie.py module from (also by Tim O'Malley) the Webware project.

VirtualBrowser.py - Cookie.py - timeoutsocket.py


html2text

html2text is a simple module for converting HTML to text. Its really brain dead and slow... but it does an ok job on some HTML messages.

html2text.py


fetchnews

fetchnews is a simple script for fetching news from a server, and placing the articles into an MBOX. I use it for archiving certain newsgroups.

fetchnews.py


who_calls

who_calls is a module which contains a couple of useful routines for generating tracebacks and dumping information about objects with high reference counts (useful for debugging memory "leaks" in python). Based on original code from Sam Rushing

who_calls.py


rbl

rbl is a simple module for using the standard python socket API for doing DNS lookups against the various RBL spam guards.

rbl.py


SafeHTML

SafeHTML is designed to take a piece of HTML, and remove tags and javascript, etc, to make the HTML safe to display. When accepting user input in HTML, one must be very careful about displaying it, because it could have malacious properties when displayed to other users (stealing cookies, running exploits against their machines, etc).

SafeHtml.py - PassSGMLParser.py


ChangeLog

The purpose of this script is to generate a log, the standard-ish rcs2log format, of all the changes that have been made between two tagged CVS versions. This is very similar to rcs2log (and even uses that) but will remove the changes that existed in the previous version: ie it will generate a log of TAG1 > log >= TAG2

ChangeLog.py


ChangeLogP4

The purpose of this script is to generate a log of all the changes that have been made between two perforce depot labels. This is similar to the above, but doesn't take as much work (again, it is necessary in order to not include changes made in the first label)

ChangeLogP4.py


Copyright (C) 2009 Brandon Long. All Rights Reserved.
blong@fiction.net / Terms of Service

The "I work for a big public company" disclaimer:
The views expressed on these pages are mine alone and not those of my employer.
I am not now, nor have I ever been employed to speak for anyone.
Well, except my own company, but that's gone now.