import requests


def twitter_get_friends_json(nickname: str, token: str) -> dict:
    """
    Get json with friends by username from twitter.
    """
    reqest_url = "https://api.twitter.com/1.1/friends/list.json"

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

    params = {
        'screen_name': f'@{nickname}',
        'count': 30
    }

    response = requests.get(
        reqest_url, headers=headers, params=params)

    return response.json()['users']