#!/usr/bin/env python import cgi, cgitb; cgitb.enable() import csv2ods, urllib, sys, tempfile form = cgi.FieldStorage() url = form.getfirst('u') f = urllib.urlopen(url) f.name = 'webtable' tmpfile = tempfile.TemporaryFile() csv2ods.csv2ods(f, tmpfile) tmpfile.seek(0) print 'Content-Type: application/octet-stream' print 'Content-Disposition: attachment; filename="webtable.ods"' print sys.stdout.write(tmpfile.read())