>>> import base64
>>> data = '{"u": "test"}'
>>> code = base64.b64encode(data)
>>> code
'eyJ1IjogInRlc3QifQ=='
I encountered this issue:
(mediagoblin)➜ ~VIRTUAL_ENV git:(master) ✗ ./runtests.sh belz
Using ./bin/py.test
+ CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_tests
+ exec ./bin/py.test ./mediagoblin/tests --boxed
/home/joar/git/mediagoblin/local/lib/python2.7/site-packages/pytest-2.3.4-py2.7.egg/_pytest/assertion/oldinterpret.py:3: DeprecationWarning: The compiler package is deprecated and removed in Python 3.x.
from compiler import parse, ast, pycodegen