documente_shared 0.1.9__py3-none-any.whl → 0.1.11__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.
Potentially problematic release.
This version of documente_shared might be problematic. Click here for more details.
- documente_shared/domain/entities.py +3 -0
- documente_shared/infrastructure/s3_bucket.py +12 -12
- {documente_shared-0.1.9.dist-info → documente_shared-0.1.11.dist-info}/METADATA +1 -1
- {documente_shared-0.1.9.dist-info → documente_shared-0.1.11.dist-info}/RECORD +5 -5
- {documente_shared-0.1.9.dist-info → documente_shared-0.1.11.dist-info}/WHEEL +0 -0
|
@@ -15,14 +15,14 @@ class S3Bucket(object):
|
|
|
15
15
|
def __post_init__(self):
|
|
16
16
|
self._resource = boto3.resource('s3')
|
|
17
17
|
|
|
18
|
-
def get(self,
|
|
18
|
+
def get(self, file_key: str) -> Optional[dict]:
|
|
19
19
|
try:
|
|
20
|
-
return self._resource.Object(self.bucket_name,
|
|
20
|
+
return self._resource.Object(self.bucket_name, file_key).get()
|
|
21
21
|
except self._resource.meta.client.exceptions.NoSuchKey:
|
|
22
22
|
return None
|
|
23
23
|
|
|
24
|
-
def get_bytes(self,
|
|
25
|
-
file_context = self.get(
|
|
24
|
+
def get_bytes(self, file_key: str) -> Optional[dict]:
|
|
25
|
+
file_context = self.get(file_key)
|
|
26
26
|
if not file_context:
|
|
27
27
|
return None
|
|
28
28
|
return (
|
|
@@ -31,21 +31,21 @@ class S3Bucket(object):
|
|
|
31
31
|
else None
|
|
32
32
|
)
|
|
33
33
|
|
|
34
|
-
def upload(self,
|
|
34
|
+
def upload(self, file_key, file_content, content_type: Optional[str] = None):
|
|
35
35
|
optional_params = {'ContentType': content_type}
|
|
36
|
-
return self._resource.Object(self.bucket_name,
|
|
36
|
+
return self._resource.Object(self.bucket_name, file_key).put(
|
|
37
37
|
Body=file_content,
|
|
38
38
|
**remove_none_values(optional_params),
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
def delete(self,
|
|
42
|
-
return self._resource.Object(self.bucket_name,
|
|
41
|
+
def delete(self, file_key):
|
|
42
|
+
return self._resource.Object(self.bucket_name, file_key).delete()
|
|
43
43
|
|
|
44
|
-
def get_url(self,
|
|
45
|
-
return 'https://{bucket_url}.s3.amazonaws.com/{
|
|
44
|
+
def get_url(self, file_key):
|
|
45
|
+
return 'https://{bucket_url}.s3.amazonaws.com/{file_key}'.format(
|
|
46
46
|
bucket_url=self.bucket_name,
|
|
47
|
-
|
|
47
|
+
file_key=file_key,
|
|
48
48
|
)
|
|
49
49
|
|
|
50
|
-
def read(self,
|
|
50
|
+
def read(self, file_key):
|
|
51
51
|
return self.get(file_name)['Body'].read()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
documente_shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
|
|
4
|
-
documente_shared/domain/entities.py,sha256=
|
|
4
|
+
documente_shared/domain/entities.py,sha256=GgsepilXNjGQ_Zdf_dE2OdNguD8EVKhqgyy5i2P5UY4,3891
|
|
5
5
|
documente_shared/domain/enums.py,sha256=o20YJClja9FQbbZhdfreGCWYwjd3AH7q2kIzV9wn2dw,251
|
|
6
6
|
documente_shared/domain/repositories.py,sha256=h_nArptP5Xh7Jrhden-Ii9rZQqzgLFHhuzj1p78LgmU,365
|
|
7
7
|
documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
documente_shared/infrastructure/dynamo_repositories.py,sha256=9t_ufQBSF7cJbeHYzfJABOQydj1HAvhI8UnqDEDPryA,532
|
|
9
9
|
documente_shared/infrastructure/dynamo_table.py,sha256=5yF5EVQkHTZe4tLYZsfEDS8tp_iorMlMjNu-qn3Oj9E,2095
|
|
10
|
-
documente_shared/infrastructure/s3_bucket.py,sha256=
|
|
10
|
+
documente_shared/infrastructure/s3_bucket.py,sha256=VqE1bVgi4R_mJkoDHk5whZxGwN27mINdV8Mg_-2Cz8I,1553
|
|
11
11
|
documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
|
|
12
|
-
documente_shared-0.1.
|
|
13
|
-
documente_shared-0.1.
|
|
14
|
-
documente_shared-0.1.
|
|
12
|
+
documente_shared-0.1.11.dist-info/METADATA,sha256=hLlvIZgQEkU3c2PLDs0Ym047IJFLt9FcAoAOBbt0bts,640
|
|
13
|
+
documente_shared-0.1.11.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
14
|
+
documente_shared-0.1.11.dist-info/RECORD,,
|
|
File without changes
|