Since requests works the same for python2.7 and python3.x, use requests instead of urllib (which returns a string in python2.7, but byte data in python3.0, at least).