switches from urllib2 to requests, also adds unittests