pyaws-s3 1.0.12__py3-none-any.whl → 1.0.17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyaws_s3/s3.py CHANGED
@@ -470,7 +470,7 @@ class S3Client:
470
470
  logger.error(f"Error downloading file: {str(e)}")
471
471
  raise Exception(f"Error downloading file: {str(e)}")
472
472
 
473
- def list_files(self, *args : Any) -> list[str]:
473
+ def list_files(self, *args: Any, **kwargs : Any) -> list[str]:
474
474
  """
475
475
  List all files in the S3 bucket.
476
476
 
@@ -482,15 +482,31 @@ class S3Client:
482
482
  list[str]: List of file names in the S3 bucket.
483
483
  """
484
484
  try:
485
- filter = args[0] if len(args) > 0 else None
485
+ prefix = args[0] if args else None
486
+ if prefix is None:
487
+ prefix = kwargs.get("prefix", None)
488
+
489
+ if prefix is None:
490
+ raise Exception("Prefix is None")
491
+
492
+ filter = kwargs.get("filter", None)
493
+
486
494
  s3_client = self._get_s3_client()
487
- objects = s3_client.list_objects_v2(Bucket=self.bucket_name)
495
+ objects = s3_client.list_objects_v2(Bucket=self.bucket_name, Prefix=prefix)
488
496
 
489
497
  # Check if the bucket contains any objects
498
+ docs : list[str] = []
490
499
  if 'Contents' in objects:
491
- return [obj['Key'] for obj in objects['Contents'] if filter in obj['Key']]
492
- else:
493
- return []
500
+ for obj in objects['Contents']:
501
+ if obj['Key']:
502
+ # Log the object key
503
+ if filter is not None:
504
+ if filter in obj['Key']:
505
+ logger.info(f"Object: {obj['Key']}")
506
+ docs.append(obj['Key'])
507
+ else:
508
+ docs.append(obj['Key'])
509
+ return docs
494
510
  except Exception as e:
495
511
  logger.error(f"Error listing files: {str(e)}")
496
512
  raise Exception(f"Error listing files: {str(e)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyaws_s3
3
- Version: 1.0.12
3
+ Version: 1.0.17
4
4
  Summary: A Python package for AWS S3 utilities
5
5
  Author-email: Giuseppe Zileni <giuseppe.zileni@gmail.com>
6
6
  Keywords: aws,s3,utilities
@@ -33,8 +33,7 @@ Requires-Dist: kiwisolver==1.4.8
33
33
  Requires-Dist: matplotlib==3.10.3
34
34
  Requires-Dist: multidict==6.4.3
35
35
  Requires-Dist: narwhals==1.39.1
36
- Requires-Dist: numpy==2.2.5
37
- Requires-Dist: packaging==23.2
36
+ Requires-Dist: packaging>=23.2
38
37
  Requires-Dist: pandas==2.2.3
39
38
  Requires-Dist: pillow==11.2.1
40
39
  Requires-Dist: plotly==6.1.0
@@ -0,0 +1,7 @@
1
+ pyaws_s3/__init__.py,sha256=Tr7xJiCKOMWYydOJ4kxHlA7AR1X3pRsJ8MjxJev2wsw,24
2
+ pyaws_s3/s3.py,sha256=ZuhqpK5uwL-0jxnKXoT-nil0QnzApNXxHUSyGypk1sc,20366
3
+ pyaws_s3-1.0.17.dist-info/licenses/LICENSE.md,sha256=7WXohDebeZpcVn_nH2aIaLhFZRvZBdcPSqWsO12lhwM,1074
4
+ pyaws_s3-1.0.17.dist-info/METADATA,sha256=HpIOBvZPjsHDaEOuzMOlpYOzO1sy13OH5w3O37pxorg,5465
5
+ pyaws_s3-1.0.17.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
6
+ pyaws_s3-1.0.17.dist-info/top_level.txt,sha256=MxSSC4Q8Vr32wKgrUAlwT4BTXwqUaG_CAWoBuPeXYjQ,9
7
+ pyaws_s3-1.0.17.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- pyaws_s3/__init__.py,sha256=Tr7xJiCKOMWYydOJ4kxHlA7AR1X3pRsJ8MjxJev2wsw,24
2
- pyaws_s3/s3.py,sha256=ZkYeD96LeoovDHR49G9LE1jhCssAN_bObmG9n85euWI,19723
3
- pyaws_s3-1.0.12.dist-info/licenses/LICENSE.md,sha256=7WXohDebeZpcVn_nH2aIaLhFZRvZBdcPSqWsO12lhwM,1074
4
- pyaws_s3-1.0.12.dist-info/METADATA,sha256=p-RlVIVY4nqB0b6eS6AXPIgmsyvMBRlAPZewHOaV2C4,5493
5
- pyaws_s3-1.0.12.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
6
- pyaws_s3-1.0.12.dist-info/top_level.txt,sha256=MxSSC4Q8Vr32wKgrUAlwT4BTXwqUaG_CAWoBuPeXYjQ,9
7
- pyaws_s3-1.0.12.dist-info/RECORD,,