mozilla-services/tokenlib — pull request #1 by rfk (2012-10-05 04:25:05+00:00)
Title: Support for Python3.

This commit makes tokenlib compatible with python26 through python33, via source-level compatibility.

The only real complication is unicode versus bytes. I've gone with the following approach:
* HKDF and related lower-level signing stuff deal only in bytes, and never do any encoding/decoding.
* High-level token functions deal only with unicode strings, because that data is always b64urlsafe and is designed for embedding in web requests.

This means that tokens are always unicode. The calling code most likely wants a "native string" as defined in PEP3333. They get that directly in python3, and via implicit conversion in python2. The conversion is safe because tokens are always ascii.

@tarekziade r?