How could I get voters from a poll?

Here’s a working solution to get what Export poll gets.

import requests
from io import StringIO
import csv
from urllib.parse import urlencode

def get_discourse_poll_results(post_id, poll_name):
    """
    Retrieves poll results from Discourse using Data Explorer's query 16,
    which returns the poll results in CSV format.
    """

    url = f"{DISCOURSE_URL}/admin/plugins/explorer/queries/-16/run.csv"

    payload = {
        "params": f'{{"poll_name":"{poll_name}","post_id":"{post_id}"}}',
        "explain": "false",
        "limit": "1000000",
        "download": "1",
    }
    headers = {
        "Api-Key": DISCOURSE_API_KEY,
        "Api-Username": DISCOURSE_API_USERNAME,
        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        "X-Requested-With": "XMLHttpRequest"
    }

    try:
        response = requests.post(url, data=urlencode(payload), headers=headers)
        response.raise_for_status()

        csv_data = StringIO(response.text)
        reader = csv.reader(csv_data)
        results = list(reader)

        processed_results = process_poll_results(results)
        reformatted_results = reformat_rating_poll(processed_results)
        return reformatted_results

    except requests.exceptions.RequestException as e:
        print(f"Error retrieving poll results: {e}")
        print(f"Response text: {response.text}")
        return None