Help users when they hit api rate limit

 - refactor out the http related code into http_get
 - introduce unit tests so fine-grained stuff like this also has tests

@patcon @rodjek