Voidspace CGI Applications
Python is a lovely language for writing web based applications. Here are a few applications, small scripts, and modules I've written for use online. They're all CGIs - hence the name of the page of course. I hope you find them useful, and I welcome feedback. Check out the Python Index Page for links to my Python modules, programs, and smaller "recipes".
|CGI Programs and Modules|
Python CGI Articles
I have written two articles on writing CGI programs with Python.
The first appeared in PyZine, but is free to view :
The first part of this article is sometimes offline. You can view a cached version of this article at CGI Articles Part One.
The second part of the article is available on Voidspace :
CGI Code Repository
Many of the projects here are also kept in an online Subversion repository.
This can be found at :
The Collaborative Web Tool
Version 0.6.0 20th September 2005
Jalopy is a 'collaborative website' creator, with a built in, online, WYSIWYG, editor (Kupu). This means it is a tool to allow a team, with non-technical members, to build a website together. It is integrated with login tools so that pages can only be created, or edited, by team members - although this is configurable.
Jalopy websites have a private index through which the site is edited. They also have a public index that is automagically updated when new pages are added, or details changed.
Jalopy means - a dilapidated old vehicle. Any program I create is bound to creak around the edges a bit, so I thought it was appropriate. It also ends in 'py', which is a tradition for projects written in Python.
The whole thing is based on html templates so that it can be incorporated into any website.
Check out the docs and the demo :
User Login and Authentication
Version 0.6.2 2nd November 2005
Login Tools was written for Jalopy. It is a framework for use with CGIs. It provides user login and authentication - with user signup, account management, and admin interface.
It can be plugged into normal CGIs with literally two lines of code, yet is extremely flexible and powerful.
Like Jalopy it's based on html templates so that it can be incorporated into any website. Try the online demo (part of Jalopy) where you can signup for a new account, or login as administrator and create/edit existing accounts.
Check out the docs and the demo :
There is also a simple demo application called Protected Page. This illustrates using logintools to protect some static pages. (Actually they're templates with some values filled in from the user details - so not entirely static). This is about forty lines of code, and illustrates how to write CGI applications that use logintools.
It includes all the pythonutils modules so it should work out of the box for you. (Other than setting permissions and checking the #! line of course.)
Come In, Make Yourself at Home
1.4.3 24th May, 2005
Everyone likes it when people leave them feedback, especially if it's positive. The Voidspace Python Guestbook is a straightforward online guestbook written in Python. It has lots of nice features, like emailing you when someone makes an entry, Unicode internally, and a naughty word filter.
It uses HTML templates - so it can be made to fit in with any site. Easy to install and use, with full instructions on the 'homepage'.
The latest added features are -
- limited html allowed in entries
- additional anti spam features
- a counter of how many times the guestbook has been viewed
Plus lots more. Phew !
Check it out at :
The Online Anagram Finder
Version 1.0.4 05th July 2004
Nanagram-CGI is the brother (and constant companion) of the desktop version of Nanagram. It's a web based anagram finder that will have you smiling for whole minutes of fun.
What's even better, is that you can freely use it on your own websites; including customising the look with good old HTML templates.
Simply have a play, or download and tinker, the choice is yours.
Domain Specific Search Engines
Skimpy is a CGI search engine that uses Yahoo Web Services. It only returns results from a specific domain list, on a specific subject.
This means you can create search engines for different topics. I haven't packaged it for distribution yet. For the moment you will have to be content with using one of :
A Family of Internet Censorship Related Tools
Version 0.6.3a 12th February 2005
approx is a CGI proxy for browsing the internet in restricted or censored internet environments. It has a few differences from the James Marshall CGI Proxy that inspired it.
If you are interested in different techniques for escaping censoring firewalls or bypassing internet restrictions, then you may be interested in my article :
It has several novel ways (with varying degrees of effectiveness) for browsing the web in restricted environments.
It doesn't help with anonymity, but it does have URL obfuscation. The latest release is a bugfix release as well as adding the URL obfuscation feature. A new version of approxClientproxy is nearly ready to upload as well, this makes browsing through the proxy transparent to the user.
Get ready to start using CGIproxy.
approx uses Scraper to parse and modify webpages it fetches.
Download it here :
Have a go with approx here. This version will only access URLs within voidspace :
For Unrestricted Browsing in a Censored Environment
Version 2.0.0 alpha February 2005
approxClientproxy is a tool to make browsing with approx a little easier. It runs as a proxy server on your machine. Every URL your browser fetches is transparently rewritten to go through an install of approx.py. By default it also obfuscates URLs that you fetch. Still at the experimental stage, but functional already.
approxClientproxy is actually a lightly modified version of aps, which is an 'NTLM Authorization Proxy Server' written in python. You need to configure it before use - see approx-README.txt in the distribution. It doesn't yet work with https locations. It already supports URL obfuscation. The next features to be added are - https support, encryption, data compression, and time limited URLs.
Download it here :
Cleaning Pages Fetched Through a Proxy
Version 1.0.1 3rd September 2004
This script is a bit in need of an update - but it's still useful, so it's still available. Both approx and the James Marshall Perl proxy work by modifying webpages fetched through them. This ensures that links and images on the page also go through the proxy. This is a pain if you need to archive or distribute the page. This script will 'clean up' the pages so that references to your proxy (whose location is likely to be private) are removed.
Download it here :
Simple Download Manager
Version 0.4.1 20th September 2005
This is a simple download manager tool. It may be egotistical, but I like to know which of my projects are being downloaded (and which aren't). Simply make your files available and have the links point to downman (see the download link below for an example) - and downman will track the downloads. At the moment it only shows simple data - but all the raw data is collected to do per week/last month (or whatever) analysis.
Currently it presents summaries of downloaded files in several ways, and offers links to all available files. It can offer files in separate sections.
It can present files from several sections - and now has a readme file explaining how to install and configure it.
Sending and Receiving Files Over HTTP
Two scripts to do with uploading files to a server
Versions 1.1.1, 7th April 2005
The first of these, upload.py, is a refactoring of a script originally by Tim Middleton. It is a simple CGI that shows a form to upload files. It receives the response and saves the file it receives.
It can be used as it stands as a configurable upload CGI, or the functions imported and used as part of a bigger program. It is for allowing the upload of multiple files to a server via an HTML FORM. You can optionally specify a maximum size for the upload directory - and also the target directory. It can email the admin when an upload is made.
upload.py - A CGI script to upload files to a server :
Version 1.0.0, 1st October 2004
The second, upload_test.py, is the other half of the equation. It shows how to do the upload to a server from Python. This example is a modification of a recipe from the Python Cookbook to use urllib2 instead of httplib. Full details inside the script of course.
upload_test.py - Demonstrating http file upload from python :
For buying techie books, science fiction, computer hardware or the latest gadgets: visit The Voidspace Amazon Store.
Last edited Tue Aug 2 00:51:34 2011.