Refactor some of the url and request duplication in client.py