documente_shared 0.1.24__tar.gz → 0.1.26__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 documente_shared might be problematic. Click here for more details.
- {documente_shared-0.1.24 → documente_shared-0.1.26}/PKG-INFO +1 -1
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/domain/entities.py +1 -1
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/domain/enums.py +1 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/s3_bucket.py +10 -4
- {documente_shared-0.1.24 → documente_shared-0.1.26}/pyproject.toml +1 -1
- {documente_shared-0.1.24 → documente_shared-0.1.26}/README.md +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/domain/repositories.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/dynamo_repositories.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/sqs_queue.py +0 -0
|
@@ -19,7 +19,7 @@ def remove_slash_from_path(path: str) -> str:
|
|
|
19
19
|
class DocumentProcess(object):
|
|
20
20
|
digest: str
|
|
21
21
|
status: DocumentProcessStatus
|
|
22
|
-
file_path: str
|
|
22
|
+
file_path: Optional[str] = None
|
|
23
23
|
file_bytes: Optional[bytes] = None
|
|
24
24
|
category: Optional[DocumentProcessCategory] = None
|
|
25
25
|
sub_category: Optional[DocumentProcessSubCategory] = None
|
{documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
@@ -3,6 +3,8 @@ import boto3
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
+
from documente_shared.domain.entities import remove_slash_from_path
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
def remove_none_values(data: dict) -> dict: # noqa: WPS110
|
|
8
10
|
return {key: value for key, value in data.items() if value is not None} # noqa: WPS110
|
|
@@ -22,7 +24,8 @@ class S3Bucket(object):
|
|
|
22
24
|
return None
|
|
23
25
|
|
|
24
26
|
def get_bytes(self, file_key: str) -> Optional[bytes]:
|
|
25
|
-
|
|
27
|
+
cleaned_file_key = remove_slash_from_path(file_key)
|
|
28
|
+
file_context = self.get(cleaned_file_key)
|
|
26
29
|
if not file_context:
|
|
27
30
|
return None
|
|
28
31
|
return (
|
|
@@ -32,19 +35,22 @@ class S3Bucket(object):
|
|
|
32
35
|
)
|
|
33
36
|
|
|
34
37
|
def upload(self, file_key: str, file_content, content_type: Optional[str] = None):
|
|
38
|
+
cleaned_file_key = remove_slash_from_path(file_key)
|
|
35
39
|
optional_params = {'ContentType': content_type}
|
|
36
|
-
return self._resource.Object(self.bucket_name,
|
|
40
|
+
return self._resource.Object(self.bucket_name, cleaned_file_key).put(
|
|
37
41
|
Body=file_content,
|
|
38
42
|
**remove_none_values(optional_params),
|
|
39
43
|
)
|
|
40
44
|
|
|
41
45
|
def delete(self, file_key: str):
|
|
42
|
-
|
|
46
|
+
cleaned_file_key = remove_slash_from_path(file_key)
|
|
47
|
+
return self._resource.Object(self.bucket_name, cleaned_file_key).delete()
|
|
43
48
|
|
|
44
49
|
def get_url(self, file_key: str):
|
|
50
|
+
cleaned_file_key = remove_slash_from_path(file_key)
|
|
45
51
|
return 'https://{bucket_url}.s3.amazonaws.com/{file_key}'.format(
|
|
46
52
|
bucket_url=self.bucket_name,
|
|
47
|
-
file_key=
|
|
53
|
+
file_key=cleaned_file_key,
|
|
48
54
|
)
|
|
49
55
|
|
|
50
56
|
def read(self, file_key: str) -> bytes:
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/dynamo_table.py
RENAMED
|
File without changes
|
{documente_shared-0.1.24 → documente_shared-0.1.26}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|