Monday, June 22, 2009

Dumpcatcher: Python HTTP and Dates libraries

Sheesh,

Python really shows its age when you have to deal with dates, http and urls. I was able to implement my signing and verification bit of code just now and it was quite a pain. I have a sample client in clients/python/example.py and the endpoint/crash.Add handler should show you the inverse side of the handshake.

The thing that was definitely most challenging was writing the example client. Because the python libraries for http, etc evolved over time there are about seventy-five ways to do an http request instead of python's normal "one."

Same can be said for datetime modules. Long ago when we had to use mx time there was a DateTime object, now its built into python so everything should be peachy? Yeah, date handling in python was improved by this change but timezones are still outrageous! Considering I'm now about 10 hours off UTC, I have had to think about how to submit a request in string form. For now though I'm going to punt and require that times submitted are in the UTC time zone.

Now that I've got that baked in, I can acutally write the code that logs the requests to the data store. After that, I need to write a bit of code to do sorting and aggregating of the crash dump data.