May 29

Programming
I need to generate multipart/form-data (see here) messages from Python. Never mind why. I dug around in the documentation for httplib, urllib, and urllib2, but it seems this is not currently supported (it’s Issue 3244). I didn’t like the code I found on the web to do it, because I needed to set additional headers on each piece. So… I wrote something. Here it is. If it’s useful to you, great! If you find bugs in it, please let me know. I think this is pretty easy to use.
Continue reading »
Tagged with: http • linkedin • multipart • multipart/form-data • Python
Mar 30
I’ve been doing some nasty database work with Python and MySQL. Specifically, I’ve got long programs that run eight to ten hours, and sometimes I need to kill them and restart them later.
So… I wanted a way to trap CTRL+C and clean up. That is, I wanted to have transactions without actually having to use transactions. I’m funny that way. (In other news, I’m probably moving to PostgreSQL at some point.)
Anyway, here’s what I came up with. You might find it useful, too. Continue reading »
Tagged with: break • ctrl+c • interrupt • linkedin • Python