Run a report from Python

The Geocortex Reporting Client for Python package provides an easy to use API for running reports.

Requirements#

  • Python 3.6 or later

Installing the package#

This package is published to PyPi, and can be installed using pip:

pip install geocortex-reporting-client

Generating a report#

The package exports a run async function that will return a URL to the report upon completion.

from geocortex.reporting.client import run
url = await run("itemid", [... other arguments])

Where:

  • itemid is the ArcGIS item ID of the report you want to run. This is always required.
  • [... other arguments] are additional optional arguments that describe how to run the report and what parameters to supply to it.

Run a report from ArcGIS Online#

url = await run("itemId")

Run a report from ArcGIS Enterprise#

To run a report from ArcGIS Enterprise you must provide the portal_url argument.

url = await run("itemId", portal_url="https://server.domain.com/portal")

Run a report with parameters#

To pass additional parameters a report you provide additional keyword arguments that match the names of parameters that exist in the report.

url = await run("itemId", Title="My Title", FeatureIds=[1, 2, 3])

Run a secured report, or a report that accesses secured ArcGIS content#

To run a secured report, or a report that accesses secured ArcGIS content you must provide the token argument that specifies the ArcGIS access token of the user running the report. The token is required to access the report item as well as any secured resources, such as ArcGIS services, that provide data for the report.

url = await run("itemId", token="eyJhbGciOiJIUzI1Ni...")