From 36888b05c12aecc85505c2749507d7346628f1f1 Mon Sep 17 00:00:00 2001 From: karel rehor Date: Mon, 25 Nov 2024 13:59:49 +0100 Subject: [PATCH] chore: remove import of asyncio in non-async API --- influxdb_client/client/flux_csv_parser.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/influxdb_client/client/flux_csv_parser.py b/influxdb_client/client/flux_csv_parser.py index 65ba5a04..99e68094 100644 --- a/influxdb_client/client/flux_csv_parser.py +++ b/influxdb_client/client/flux_csv_parser.py @@ -1,6 +1,5 @@ """Parsing response from InfluxDB to FluxStructures or DataFrame.""" -import asyncio import base64 import codecs import csv as csv_parser @@ -147,8 +146,10 @@ async def _parse_flux_response_async(self): df = self._prepare_data_frame() if not self._is_profiler_table(metadata.table): yield df - except (asyncio.exceptions.CancelledError, asyncio.TimeoutError) as ce: - ce.add_note("Stream cancelled during read. Recommended: Check Influxdb client `timeout` setting.") + except BaseException as e: + e_type = type(e).__name__ + if "CancelledError" in e_type or "TimeoutError" in e_type: + e.add_note("Stream cancelled during read. Recommended: Check Influxdb client `timeout` setting.") raise finally: self._close()