def _get_readwise_data(api_key: str, updated_after: Optional[datetime.datetime] = None):
    """
    Uses Readwise's export API to export all highlights, optionally after a specified date.

    See https://readwise.io/api_deets for details.

    Args:
        updated_after (datetime.datetime): The datetime to load highlights after. Useful for updating indexes over time.

    """
    result = []
    next_page = None
    while True:
        response = requests.get(
            url="https://readwise.io/api/v2/export/",
            params={
                "pageCursor": next_page,
                "updatedAfter": updated_after.isoformat() if updated_after else None,
            },
            headers={"Authorization": f"Token {api_key}"},
        )
        response.raise_for_status()
        result.extend(response.json()["results"])
        next_page = response.json().get("nextPageCursor")
        if not next_page:
            break
    return result

    Uses Readwise's export API to export all highlights, optionally after a specified date.

    See https://readwise.io/api_deets for details.

    Args:
        updated_after (datetime.datetime): The datetime to load highlights after. Useful for updating indexes over time.

    
llama-index-integrations/readers/llama-index-readers-readwise/llama_index/readers/readwise/base.py