jvserve 2.1.24__py3-none-any.whl → 2.1.25__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.
- jvserve/lib/file_interface.py +15 -6
- {jvserve-2.1.24.dist-info → jvserve-2.1.25.dist-info}/METADATA +1 -1
- {jvserve-2.1.24.dist-info → jvserve-2.1.25.dist-info}/RECORD +7 -7
- {jvserve-2.1.24.dist-info → jvserve-2.1.25.dist-info}/WHEEL +0 -0
- {jvserve-2.1.24.dist-info → jvserve-2.1.25.dist-info}/entry_points.txt +0 -0
- {jvserve-2.1.24.dist-info → jvserve-2.1.25.dist-info}/licenses/LICENSE +0 -0
- {jvserve-2.1.24.dist-info → jvserve-2.1.25.dist-info}/top_level.txt +0 -0
jvserve/lib/file_interface.py
CHANGED
|
@@ -28,7 +28,7 @@ class FileInterface(ABC):
|
|
|
28
28
|
pass
|
|
29
29
|
|
|
30
30
|
@abstractmethod
|
|
31
|
-
def save_file(self, filename: str, content: bytes) -> bool:
|
|
31
|
+
def save_file(self, filename: str, content: bytes, content_type: str = "") -> bool:
|
|
32
32
|
"""Save content to a file in storage."""
|
|
33
33
|
pass
|
|
34
34
|
|
|
@@ -58,7 +58,7 @@ class LocalFileInterface(FileInterface):
|
|
|
58
58
|
return f.read()
|
|
59
59
|
return None
|
|
60
60
|
|
|
61
|
-
def save_file(self, filename: str, content: bytes) -> bool:
|
|
61
|
+
def save_file(self, filename: str, content: bytes, content_type: str = "") -> bool:
|
|
62
62
|
"""Write content to a local file."""
|
|
63
63
|
file_path = os.path.join(self.__root_dir, filename)
|
|
64
64
|
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
|
@@ -124,13 +124,22 @@ class S3FileInterface(FileInterface):
|
|
|
124
124
|
except Exception:
|
|
125
125
|
return None
|
|
126
126
|
|
|
127
|
-
def save_file(self, filename: str, content: bytes) -> bool:
|
|
127
|
+
def save_file(self, filename: str, content: bytes, content_type: str = "") -> bool:
|
|
128
128
|
"""Save file to S3 bucket."""
|
|
129
129
|
try:
|
|
130
130
|
file_key = os.path.join(self.__root_dir, filename)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
|
|
132
|
+
if content_type:
|
|
133
|
+
self.s3_client.put_object(
|
|
134
|
+
Bucket=self.bucket_name,
|
|
135
|
+
Key=file_key,
|
|
136
|
+
Body=content,
|
|
137
|
+
ContentType=content_type,
|
|
138
|
+
)
|
|
139
|
+
else:
|
|
140
|
+
self.s3_client.put_object(
|
|
141
|
+
Bucket=self.bucket_name, Key=file_key, Body=content
|
|
142
|
+
)
|
|
134
143
|
return True
|
|
135
144
|
except Exception:
|
|
136
145
|
return False
|
|
@@ -3,12 +3,12 @@ jvserve/cli.py,sha256=CA1fg-pmn30gwl9V48KJ_ThuDOPfaCxZOGfAtOd4gCg,17058
|
|
|
3
3
|
jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
|
|
4
4
|
jvserve/lib/agent_interface.py,sha256=cO2ZgII33YU6m2zU_qTThAPoHcfg8V3dAMPFGaZAun4,5511
|
|
5
5
|
jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
|
|
6
|
-
jvserve/lib/file_interface.py,sha256=
|
|
6
|
+
jvserve/lib/file_interface.py,sha256=QoudrCfx-mmLDrxciBOyibuqp21H4ET9isEfTyvd0SM,6431
|
|
7
7
|
jvserve/lib/jac_interface.py,sha256=hugcHF6by6_fIFfmvW7fgRMVpKe471oEWEZEA53MtEQ,8148
|
|
8
8
|
jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
|
|
9
|
-
jvserve-2.1.
|
|
10
|
-
jvserve-2.1.
|
|
11
|
-
jvserve-2.1.
|
|
12
|
-
jvserve-2.1.
|
|
13
|
-
jvserve-2.1.
|
|
14
|
-
jvserve-2.1.
|
|
9
|
+
jvserve-2.1.25.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
10
|
+
jvserve-2.1.25.dist-info/METADATA,sha256=pv8ERw_E2H7qrih1vIppkKOazvdWZMnDwRZUJKQlED8,4873
|
|
11
|
+
jvserve-2.1.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
jvserve-2.1.25.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
|
|
13
|
+
jvserve-2.1.25.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
|
|
14
|
+
jvserve-2.1.25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|