maleo-foundation 0.2.65__py3-none-any.whl → 0.2.66__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.
- maleo_foundation/managers/client/google/storage.py +12 -4
- {maleo_foundation-0.2.65.dist-info → maleo_foundation-0.2.66.dist-info}/METADATA +1 -1
- {maleo_foundation-0.2.65.dist-info → maleo_foundation-0.2.66.dist-info}/RECORD +5 -5
- {maleo_foundation-0.2.65.dist-info → maleo_foundation-0.2.66.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.2.65.dist-info → maleo_foundation-0.2.66.dist-info}/top_level.txt +0 -0
@@ -53,7 +53,8 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
53
53
|
location:str,
|
54
54
|
content_type:Optional[str]=None,
|
55
55
|
make_public:bool=False,
|
56
|
-
expiration:timedelta=timedelta(minutes=15)
|
56
|
+
expiration:timedelta=timedelta(minutes=15),
|
57
|
+
root_location_override:BaseTypes.OptionalString=None
|
57
58
|
) -> str:
|
58
59
|
"""
|
59
60
|
Upload a file to Google Cloud Storage.
|
@@ -67,7 +68,10 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
67
68
|
Returns:
|
68
69
|
str: The public URL or blob path depending on `make_public`.
|
69
70
|
"""
|
70
|
-
|
71
|
+
if root_location_override is None or (isinstance(root_location_override, str) and len(root_location_override) <= 0):
|
72
|
+
blob = self._bucket.blob(f"{self._root_location}/{location}")
|
73
|
+
else:
|
74
|
+
blob = self._bucket.blob(f"{root_location_override}/{location}")
|
71
75
|
blob.upload_from_string(content, content_type=content_type)
|
72
76
|
|
73
77
|
if make_public:
|
@@ -84,7 +88,8 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
84
88
|
def generate_signed_url(
|
85
89
|
self,
|
86
90
|
location:str,
|
87
|
-
expiration:timedelta=timedelta(minutes=15)
|
91
|
+
expiration:timedelta=timedelta(minutes=15),
|
92
|
+
root_location_override:BaseTypes.OptionalString=None
|
88
93
|
) -> str:
|
89
94
|
"""
|
90
95
|
generate signed URL of a file in the bucket based on its location.
|
@@ -99,7 +104,10 @@ class GoogleCloudStorage(GoogleClientManager):
|
|
99
104
|
Raises:
|
100
105
|
ValueError: If the file does not exist
|
101
106
|
"""
|
102
|
-
|
107
|
+
if root_location_override is None or (isinstance(root_location_override, str) and len(root_location_override) <= 0):
|
108
|
+
blob = self._bucket.blob(blob_name=f"{self._root_location}/{location}")
|
109
|
+
else:
|
110
|
+
blob = self._bucket.blob(blob_name=f"{root_location_override}/{location}")
|
103
111
|
if not blob.exists():
|
104
112
|
raise ValueError(f"File '{location}' did not exists.")
|
105
113
|
|
@@ -45,7 +45,7 @@ maleo_foundation/managers/client/google/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
|
|
45
45
|
maleo_foundation/managers/client/google/base.py,sha256=eIdd6C2BFIu4EyZ1j017VZaJn_nSTPGFftBwQmVAUDA,1366
|
46
46
|
maleo_foundation/managers/client/google/parameter.py,sha256=Lnj7mQgxWQpsQwbmDRK5_bF01M1QpM5PS0eZP2q17yQ,1337
|
47
47
|
maleo_foundation/managers/client/google/secret.py,sha256=Ski1CHYeA8vjSk2Oc2Pf4CfFrzT_RcA6NEZwza7gM7Y,4464
|
48
|
-
maleo_foundation/managers/client/google/storage.py,sha256=
|
48
|
+
maleo_foundation/managers/client/google/storage.py,sha256=6pmpR44mOWhgad0ylyz0xoHCAfVo-AC3cT95tRKlNNM,4370
|
49
49
|
maleo_foundation/middlewares/authentication.py,sha256=UL6kL65SvqrzemlIDopoO9N1C05eWlYMHVR2tiRsVEA,4821
|
50
50
|
maleo_foundation/middlewares/base.py,sha256=0vHU0CJEj9s3slGE3fxCQwL0_hqXW-xvhu82WRVpkpg,14551
|
51
51
|
maleo_foundation/middlewares/cors.py,sha256=9uvBvY2N6Vxa9RP_YtESxcWo6Doi6uS0lzAG9iLY7Uc,2288
|
@@ -118,7 +118,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
118
118
|
maleo_foundation/utils/loaders/credential/google.py,sha256=SKsqPuFnAiCcYLf24CxKnMybhVHpgqnq1gGSlThqjts,994
|
119
119
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
120
120
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
121
|
-
maleo_foundation-0.2.
|
122
|
-
maleo_foundation-0.2.
|
123
|
-
maleo_foundation-0.2.
|
124
|
-
maleo_foundation-0.2.
|
121
|
+
maleo_foundation-0.2.66.dist-info/METADATA,sha256=bY6sPTZ-OaBLRJpHBQS3Yqm3bpFPouOI1nhlvSqi9rs,3598
|
122
|
+
maleo_foundation-0.2.66.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
123
|
+
maleo_foundation-0.2.66.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
124
|
+
maleo_foundation-0.2.66.dist-info/RECORD,,
|
File without changes
|
File without changes
|