Skip to content

{ Category Archives } Python

Reading cookies from most Firefox versions…

Yesterday, I wrote about how to reading the cookies from Firefox 3.0 from Python. This code snippet extends the previous example by adding code which finds the cookie file on various different operating systems (Windows, Linux and Mac OS X). Hope this helps people who need to do this.

#! /usr/bin/env python
# Reading the cookie’s from [...]

Tagged , , , ,

$#%#! UTF-8 in Python

This is not a post about using UTF-8 properly in Python, but doing evil, evil things.
Python dutifully respects the $LANG environment variable on the terminal. It turns out that a lot of the time this variable is totally wrong, it’s set to something like C even though the terminal is UTF-8 encoding.
The problem is [...]

Tagged , , , , ,

Reading Firefox 3.x cookies in Python

I found the following code snippet on my hard drive today. It allows you to access Firefox 3.x cookies in Python. Firefox 3.x moved away from the older text file format to a sqlite database.
This code is useful if you want to access something behind an authentication gateway and you also access the page through [...]

Tagged , , , ,

Cool Python, Swaping two variables

Some people say “you learn something new everyday” or something like that. Today someone on #python showed me a cool trick I never would have thought of on my own.
Often there is a time when you want to swap the contents of two variables. The most popular way to do this is using a third [...]

Skimpy, Scheme in Python

For something a bit different, I decided to work on making embedding Scheme in Python easier. I’ve previously been using the cool PyScheme, however it hasn’t been updated in quite a long time (since 2004) and is quite slow.
The reason I would want to do something crazy like this is that Thousand Parsec use a [...]