Make sure base URL is non-unicode string on Python 2 (fixes #235)