import requests


def _get_repo_list(user: str, token: str) -> list:
    """
    Retrieves the list of repositories for the given username.

    :param user:
        The Bitbucket username
    :param token:
        The Bitbucket access token
    :return:
        A JSON object with the list of repositories
    """
    url = 'https://api.bitbucket.org/2.0/repositories/{}'.format(user)

    headers = {
        'Authorization': 'Bearer {}'.format(token)
    }

    response = requests.get(url, headers=headers)

    if response.status_code != requests.codes.get('ok'):
        response.raise_for_status()

    return response.json()['values']