def check_namespace(namespace): """ Checks if the namespace provided is a valid GitHub organization. :param namespace: The namespace to check. :type namespace: string :return: Whether or not the namespace is valid. :rtype: bool """ oauth = get_oauth_client() response = oauth.get('https://api.github.com/users/' + namespace) return response.ok
def get_namespace(namespace): """ Gets info on the GitHub account/organization provided. :param namespace: The namespace to get. :type namespace: string :return: Dict of info on the account in question. :rtype: dict """ oauth = get_oauth_client() response = oauth.get('https://api.github.com/users/' + namespace) if response.ok: return response.json() else: return {'errors': {'namespace': 'Invalid GitHub account namespace'}}