sharedkernel 1.7.2__tar.gz → 1.7.3__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.
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/PKG-INFO +3 -1
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/README.md +2 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/setup.py +1 -1
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/s3_uploader.py +11 -5
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel.egg-info/PKG-INFO +3 -1
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/setup.cfg +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/common.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/database/__init__.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/database/mongo_generic_repository.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/database/vector_database_repository/__init__.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/database/vector_database_repository/chroma_startegy.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/database/vector_database_repository/vector_database_repository.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/database/vector_database_repository/vector_database_strategy.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/date_converter.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/enum/__init__.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/enum/error_code.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/enum/vector_database_type.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/exception/__init__.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/exception/exception.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/exception/exception_handlers.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/jwt_service.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/normalizer/__init__.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/normalizer/phone_number_normalizer.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/objects/__init__.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/objects/base_document.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/objects/jwt_model.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/objects/result.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/regex_masking.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/string_extentions.py +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel.egg-info/SOURCES.txt +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel.egg-info/dependency_links.txt +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel.egg-info/requires.txt +0 -0
- {sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sharedkernel
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.3
|
|
4
4
|
Summary: sharekernel is a shared package between all python projects
|
|
5
5
|
Author: Smilinno
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -20,6 +20,8 @@ Requires-Dist: boto3
|
|
|
20
20
|
this a shared kernel package
|
|
21
21
|
|
|
22
22
|
# Change Log
|
|
23
|
+
### Version 1.7.3
|
|
24
|
+
- Add optional folder name for s3 uploader to save the file in
|
|
23
25
|
### Version 1.7.2
|
|
24
26
|
- Fix bug of to_diff_persian_date_time_string
|
|
25
27
|
### Version 1.7.1
|
|
@@ -35,7 +35,7 @@ setup(
|
|
|
35
35
|
"boto3"
|
|
36
36
|
],
|
|
37
37
|
# *strongly* suggested for sharing
|
|
38
|
-
version="1.7.
|
|
38
|
+
version="1.7.3",
|
|
39
39
|
description="sharekernel is a shared package between all python projects",
|
|
40
40
|
long_description=long_description,
|
|
41
41
|
long_description_content_type="text/markdown",
|
|
@@ -27,13 +27,14 @@ class S3Uploader:
|
|
|
27
27
|
aws_secret_access_key=self.secret_key,
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
def upload_file_object(self, file_obj, object_name=None, file_extension=None):
|
|
30
|
+
def upload_file_object(self, file_obj, object_name=None, file_extension=None, folder_name=None):
|
|
31
31
|
"""
|
|
32
32
|
Uploads a file object to an S3 bucket and returns its URL.
|
|
33
33
|
|
|
34
34
|
:param file_obj: File object to upload
|
|
35
35
|
:param object_name: S3 file name to save as (optional)
|
|
36
36
|
:param file_extension: File extension to append to object name (optional)
|
|
37
|
+
:param folder_name: Optional folder name to save the file in
|
|
37
38
|
:return: URL of the uploaded file if successful, else False
|
|
38
39
|
"""
|
|
39
40
|
# Use uuid4 to generate a unique object_name if not provided
|
|
@@ -44,6 +45,10 @@ class S3Uploader:
|
|
|
44
45
|
if file_extension:
|
|
45
46
|
object_name += file_extension
|
|
46
47
|
|
|
48
|
+
# Prefix the object name with the folder if provided
|
|
49
|
+
if folder_name:
|
|
50
|
+
object_name = f"{folder_name}/{object_name}"
|
|
51
|
+
|
|
47
52
|
# Upload the file object
|
|
48
53
|
self.s3.upload_fileobj(file_obj, self.bucket, object_name, ExtraArgs={'ACL':'public-read'})
|
|
49
54
|
print(f"File object uploaded to {self.bucket} as {object_name}.")
|
|
@@ -53,20 +58,21 @@ class S3Uploader:
|
|
|
53
58
|
|
|
54
59
|
return file_url
|
|
55
60
|
|
|
56
|
-
def upload_file_from_url(self, file_url, object_name=None):
|
|
61
|
+
def upload_file_from_url(self, file_url, object_name=None, folder_name=None):
|
|
57
62
|
"""
|
|
58
63
|
Downloads a file from a URL and uploads it to an S3 bucket, returning its URL.
|
|
59
64
|
|
|
60
65
|
:param file_url: URL of the file to download
|
|
61
66
|
:param object_name: S3 file name to save as (optional)
|
|
67
|
+
:param folder_name: Optional folder name to save the file in
|
|
62
68
|
:return: URL of the uploaded file if successful, else False
|
|
63
69
|
"""
|
|
64
70
|
# Step 1: Download the file from the provided URL
|
|
65
71
|
response = requests.get(file_url)
|
|
66
72
|
response.raise_for_status() # Check if the request was successful
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
file_extension = os.path.splitext(file_url)[1] # Get extension from URL (e.g., .jpg, .
|
|
74
|
+
# Extract file extension from the URL if available
|
|
75
|
+
file_extension = os.path.splitext(file_url)[1] # Get extension from URL (e.g., .jpg, .mp3, etc.)
|
|
70
76
|
|
|
71
77
|
# Use the filename from the URL if no object_name is provided, otherwise use uuid4
|
|
72
78
|
if object_name is None:
|
|
@@ -74,4 +80,4 @@ class S3Uploader:
|
|
|
74
80
|
|
|
75
81
|
# Step 2: Upload the file to S3
|
|
76
82
|
file_obj = BytesIO(response.content)
|
|
77
|
-
return self.upload_file_object(file_obj, object_name, file_extension)
|
|
83
|
+
return self.upload_file_object(file_obj=file_obj, object_name=object_name, file_extension=file_extension, folder_name=folder_name)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sharedkernel
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.3
|
|
4
4
|
Summary: sharekernel is a shared package between all python projects
|
|
5
5
|
Author: Smilinno
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -20,6 +20,8 @@ Requires-Dist: boto3
|
|
|
20
20
|
this a shared kernel package
|
|
21
21
|
|
|
22
22
|
# Change Log
|
|
23
|
+
### Version 1.7.3
|
|
24
|
+
- Add optional folder name for s3 uploader to save the file in
|
|
23
25
|
### Version 1.7.2
|
|
24
26
|
- Fix bug of to_diff_persian_date_time_string
|
|
25
27
|
### Version 1.7.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sharedkernel-1.7.2 → sharedkernel-1.7.3}/sharedkernel/normalizer/phone_number_normalizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|