Refactor use of 'requests' into helper functions

This will make it easier to make the CLI use json.