def find_projects(): """ Find and list all projects the caller has access to. :return: a list of project objects """ client = Configuration.client() r = client.get("projects") if r.status_code == 200: return Success({'projects': [Project(client, p) for p in r.json()['projects']]}) else: return Error({'error': "Error finding projects - %d: %s" % (r.status_code, r.text)})
def get_project(project_slug): """ Gets a specific project for the specified slug. :param project_slug: the unique human readable identifier for the project to retrieve :return: a project object """ client = Configuration.client() r = client.get("projects/%s" % project_slug) if r.status_code == 200: obj = r.json() proj_attrs = obj['project'] stack_attrs = obj['stack'] proj_attrs['stack'] = stack_attrs return Success({'project': Project(client, proj_attrs)}) else: return Error({'error': "Error getting project with slug %s - %d: %s" % (project_slug, r.status_code, r.text)})