import requests


def request_inform(server, requester, player, id, colour=None, rank=None):
    """
    Give a player information about a card.
    """
    data = {'recipient': player}
    if colour is None:
        assert(rank is not None)
        data['rank'] = rank
    if rank is None:
        assert(colour is not None)
        data['colour'] = colour.lower().capitalize()

    url = server + '/inform/{id}/{player}'.format(id=id, player=requester)
    r = requests.post('http://' + url, data=data)
    return r.text