import json


def get_projects_and_ids(session, url):
    """Reads projects from OpenProject and returns project names and ids"""

    read_url = json.loads(session.get(url+"projects/").content.decode('utf-8'))
    raw_projects = read_url['_embedded']['elements']
    parsed_projects = {elem['name']:elem['id'] for elem in raw_projects}

    return parsed_projects