Added httplib error handling