Catch httperror before urlerror. In fact, just handle urlerror like any other exception.