def get_org_repos(name): """ Fetch the repos that belong to an organization. :return: An effect resulting in a list of strings naming the repositories. """ req = Effect( HTTPRequest("get", "https://api.github.com/orgs/{0}/repos".format(name))) return req.on_success(lambda x: [repo['name'] for repo in json.loads(x)])
def get_orgs(name): """ Fetch the organizations a user belongs to. :return: An Effect resulting in a list of strings naming the user's organizations. """ req = Effect( HTTPRequest("get", "https://api.github.com/users/{0}/orgs".format(name))) return req.on_success(lambda x: [org['login'] for org in json.loads(x)])