Use requests library, refactor some code

Eliminate use of urllib/urllib2 in favor of requests.