my-aws-helpers 2.3.0__tar.gz → 2.4.0__tar.gz

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.

Potentially problematic release.


This version of my-aws-helpers might be problematic. Click here for more details.

Files changed (20) hide show
  1. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/PKG-INFO +1 -1
  2. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/s3.py +8 -3
  3. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers.egg-info/PKG-INFO +1 -1
  4. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/setup.py +1 -1
  5. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/README.md +0 -0
  6. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/api.py +0 -0
  7. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/auth.py +0 -0
  8. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/cognito.py +0 -0
  9. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/dynamo.py +0 -0
  10. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/errors.py +0 -0
  11. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/event.py +0 -0
  12. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/logging.py +0 -0
  13. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers/sfn.py +0 -0
  14. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers.egg-info/SOURCES.txt +0 -0
  15. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers.egg-info/dependency_links.txt +0 -0
  16. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers.egg-info/requires.txt +0 -0
  17. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers.egg-info/top_level.txt +0 -0
  18. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/my_aws_helpers.egg-info/zip-safe +0 -0
  19. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/setup.cfg +0 -0
  20. {my_aws_helpers-2.3.0 → my_aws_helpers-2.4.0}/tests/test_event.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: my_aws_helpers
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: AWS Helpers
5
5
  Home-page: https://github.com/JarrodMccarthy/aws_helpers.git
6
6
  Author: Jarrod McCarthy
@@ -45,8 +45,13 @@ class S3Location:
45
45
  class S3:
46
46
  client: boto3.client
47
47
 
48
- def __init__(self, client: Optional[boto3.client] = None) -> None:
48
+ def __init__(
49
+ self,
50
+ client: Optional[boto3.client] = None,
51
+ resource: Optional[boto3.resource] = None,
52
+ ) -> None:
49
53
  self.client = client if client else self._get_client()
54
+ self.resource = resource if resource else boto3.resource('s3')
50
55
 
51
56
  def _get_client(self) -> boto3.client:
52
57
  region_name = os.environ["AWS_DEFAULT_REGION"]
@@ -114,7 +119,7 @@ class S3:
114
119
  if compress or s3_location.file_name.endswith(".gz"):
115
120
  file_contents = gzip.compress(file_contents)
116
121
  content_encoding = ContentEncoding.gzip.value
117
- obj = self.client.Object(s3_location.bucket, s3_location.file_name)
122
+ obj = self.resource.Object(s3_location.bucket, s3_location.file_name)
118
123
  obj.put(
119
124
  Body=file_contents,
120
125
  ContentType=content_type,
@@ -127,7 +132,7 @@ class S3:
127
132
 
128
133
  def read_binary_from_s3(self, s3_location: S3Location) -> Optional[bytes]:
129
134
  try:
130
- obj = self.client.Object(s3_location.bucket, s3_location.file_name)
135
+ obj = self.resource.Object(s3_location.bucket, s3_location.file_name)
131
136
  d_bytes = io.BytesIO()
132
137
  obj.download_fileobj(d_bytes)
133
138
  d_bytes.seek(0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: my-aws-helpers
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: AWS Helpers
5
5
  Home-page: https://github.com/JarrodMccarthy/aws_helpers.git
6
6
  Author: Jarrod McCarthy
@@ -3,7 +3,7 @@ from setuptools import find_namespace_packages, setup
3
3
 
4
4
  base_path = os.path.abspath(os.path.dirname(__file__))
5
5
 
6
- version = "2.3.0"
6
+ version = "2.4.0"
7
7
 
8
8
  setup(
9
9
  name="my_aws_helpers",
File without changes
File without changes