changed httplib to urllib2 and associated codes