fixed encoding issue for urllib on python 3 and changed assertEquals to assertEqual since the former is now deprecated