czds

- ICANN Centralized Zone Data Service Tool
git clone git://git.acid.vegas/czds.git
Log | Files | Refs | Archive | README | LICENSE

commit 656bd50e47710cbdd9b4035dfc5d6eb753adb557
parent 93d2bec2045f3f396ceee9766918a640ae55470a
Author: acidvegas <acid.vegas@acid.vegas>
Date: Sun, 23 Mar 2025 19:05:10 -0400

Fix timeouts and error reporting

Diffstat:
Mczds/__init__.py | 2+-
Mczds/client.py | 12+++---------
Msetup.py | 2+-

3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/czds/__init__.py b/czds/__init__.py
@@ -5,7 +5,7 @@
 from .client import CZDS
 
 
-__version__ = '1.3.2'
+__version__ = '1.3.3'
 __author__  = 'acidvegas'
 __email__   = 'acid.vegas@acid.vegas'
 __github__  = 'https://github.com/acidvegas/czds'
 \ No newline at end of file
diff --git a/czds/client.py b/czds/client.py
@@ -171,7 +171,7 @@ class CZDS:
             tld_name    = url.split('/')[-1].split('.')[0] # Extract TLD from URL
             max_retries = 10                               # Maximum number of retries for failed downloads
             retry_delay = 5                                # Delay between retries in seconds
-            timeout     = aiohttp.ClientTimeout(total=120) # Timeout for the download
+            timeout     = aiohttp.ClientTimeout(total=None, connect=60, sock_connect=60, sock_read=None)
             
             # Start the attempt loop
             for attempt in range(max_retries):
@@ -219,7 +219,7 @@ class CZDS:
                                         await file.write(chunk)
                                         total_size += len(chunk)
                                         pbar.update(len(chunk))
-                                except (asyncio.TimeoutError, aiohttp.ClientError) as e:
+                                except Exception as e:
                                     logging.error(f'Connection error while downloading {tld_name}: {str(e)}')
                                     if attempt + 1 < max_retries:
                                         logging.info(f'Retrying {tld_name} in {retry_delay} seconds...')
@@ -246,7 +246,7 @@ class CZDS:
 
                         return filepath
 
-                except (aiohttp.ClientError, asyncio.TimeoutError) as e:
+                except Exception as e:
                     if attempt + 1 >= max_retries:
                         logging.error(f'Failed to download {tld_name} after {max_retries} attempts: {str(e)}')
                         if 'filepath' in locals() and os.path.exists(filepath):
@@ -255,12 +255,6 @@ class CZDS:
                     logging.warning(f'Download attempt {attempt + 1} failed for {tld_name}: {str(e)}')
                     await asyncio.sleep(retry_delay)
 
-                except Exception as e:
-                    logging.error(f'Error downloading {tld_name}: {str(e)}')
-                    if 'filepath' in locals() and os.path.exists(filepath):
-                        os.remove(filepath)
-                    raise
-
         async with semaphore:
             return await _download()
 
diff --git a/setup.py b/setup.py
@@ -11,7 +11,7 @@ with open('README.md', 'r', encoding='utf-8') as fh:
 
 setup(
 	name='czds-api',
-	version='1.3.2',
+	version='1.3.3',
 	author='acidvegas',
 	author_email='acid.vegas@acid.vegas',
 	description='ICANN API for the Centralized Zones Data Service',