import requests


def get_block(cp: int, timestamp: int, policy: int):
    """
    Gets a specific block from the ledger.
    :param cp: The ID of the CP on the ledger.
    :param timestamp: The timestamp at which the proofs are valid.
    :param policy: The CP policy the proofs are associated with.
    :return:
    """
    params = {
        'ownerParam': "resource:digid.CertificationProvider#" + str(cp),
        'timestampParam': timestamp,
        'policyParam': policy
    }
    res = requests.get('http://ap_rest_api:3000/api/queries/ProofBlockQuery', params=params)
    data = res.json()[0] if len(res.json()) != 0 else None
    return data