How to use the flowclient.async_client.get_geojson_result_by_query_id function in flowclient

To help you get started, we’ve selected a few flowclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flowminder / FlowKit / flowclient / flowclient / async_api_query.py View on Github external
Result format. One of {'pandas', 'geojson'}
        poll_interval : int, default 1
            Number of seconds to wait between checks for the query being ready
        disable_progress : bool, default None
            Set to True to disable progress bar display entirely, None to disable on
            non-TTY, or False to always enable

        Returns
        -------
        pandas.DataFrame or dict
            Query result
        """
        if format == "pandas":
            result_getter = get_result_by_query_id
        elif format == "geojson":
            result_getter = get_geojson_result_by_query_id
        else:
            raise ValueError(
                f"Invalid format: '{format}'. Expected one of {{'pandas', 'geojson'}}."
            )

        # TODO: Cache result internally?
        try:
            return await result_getter(
                connection=self.connection,
                query_id=self._query_id,
                poll_interval=poll_interval,
                disable_progress=disable_progress,
            )
        except (AttributeError, FileNotFoundError):
            # TODO: Warn before running?
            await self.run()