The Python code listed below are examples on how to extract Confluence users to CSV or XLSX export format via REST API and servlets.
...
CONFLUENCE_USERNAME = Confluence username
CONFLUENCE_PASSWORD = Confluence password
CONFLUENCE_BASEURL = Confluence url eg. https://jira.yourdomainyourconfluence.com
CONFLUENCE_CSV_FILE_NAME = Name of the file to generate
...