rb-commons 0.7.8__py3-none-any.whl → 0.7.9__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.
- rb_commons/orm/enum.py +6 -1
- rb_commons/utils/media.py +18 -5
- {rb_commons-0.7.8.dist-info → rb_commons-0.7.9.dist-info}/METADATA +1 -1
- {rb_commons-0.7.8.dist-info → rb_commons-0.7.9.dist-info}/RECORD +6 -6
- {rb_commons-0.7.8.dist-info → rb_commons-0.7.9.dist-info}/WHEEL +0 -0
- {rb_commons-0.7.8.dist-info → rb_commons-0.7.9.dist-info}/top_level.txt +0 -0
rb_commons/orm/enum.py
CHANGED
rb_commons/utils/media.py
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
1
3
|
from pydantic import ValidationError
|
4
|
+
from rb_commons.orm.enum import MediaSource
|
5
|
+
|
2
6
|
|
3
7
|
class MediaUtils:
|
8
|
+
BILLZ_S3_ENDPOINT_URL = "https://cdn-grocery.billz.ai/billz"
|
9
|
+
BITTO_S3_ENDPOINT_URL = "https://api.bito.uz/upload-api/public/uploads"
|
10
|
+
|
11
|
+
@classmethod
|
12
|
+
def url_builder(cls, key: str, source: Optional[MediaSource] = MediaSource.ROBO):
|
13
|
+
source = MediaSource.ROBO if source is None else source
|
4
14
|
|
5
|
-
@staticmethod
|
6
|
-
def url_builder(key: str):
|
7
15
|
try:
|
8
16
|
from rb_commons.configs.config import configs
|
9
17
|
DIGITALOCEAN_S3_ENDPOINT_URL = configs.DIGITALOCEAN_S3_ENDPOINT_URL
|
@@ -13,6 +21,11 @@ class MediaUtils:
|
|
13
21
|
DIGITALOCEAN_S3_ENDPOINT_URL = configs.DIGITALOCEAN_S3_ENDPOINT_URL
|
14
22
|
DIGITALOCEAN_STORAGE_BUCKET_NAME = configs.DIGITALOCEAN_STORAGE_BUCKET_NAME
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
media_url = f"{DIGITALOCEAN_S3_ENDPOINT_URL}/{DIGITALOCEAN_STORAGE_BUCKET_NAME}/{key}"
|
25
|
+
|
26
|
+
if source == MediaSource.BILLZ:
|
27
|
+
media_url = f"{cls.BILLZ_S3_ENDPOINT_URL}/{key}"
|
28
|
+
elif source == MediaSource.BITO:
|
29
|
+
media_url = f"{cls.BITTO_S3_ENDPOINT_URL}/{key}"
|
30
|
+
|
31
|
+
return media_url
|
@@ -12,7 +12,7 @@ rb_commons/http/base_api.py,sha256=ZiSJX5z-1QbL5RuKm30wf-3kbOu4s2plb8q3v0DQUKo,5
|
|
12
12
|
rb_commons/http/consul.py,sha256=Ioq72VD1jGwoC96set7n2SgxN40olzI-myA2lwKkYi4,1864
|
13
13
|
rb_commons/http/exceptions.py,sha256=EGRMr1cRgiJ9Q2tkfANbf0c6-zzXf1CD6J3cmCaT_FA,1885
|
14
14
|
rb_commons/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
rb_commons/orm/enum.py,sha256=
|
15
|
+
rb_commons/orm/enum.py,sha256=1hrEKtfOKc4DPZ8-2z6Xt4ieHOZJ6K0vl9XGktiZArw,227
|
16
16
|
rb_commons/orm/exceptions.py,sha256=1aMctiEwrPjyehoXVX1l6ML5ZOhmDkmBISzlTD5ey1Y,509
|
17
17
|
rb_commons/orm/managers.py,sha256=BrpMvOkRoAPKtUV1SfakXMYd73-RhqIaoj1Wmru1gAs,20319
|
18
18
|
rb_commons/orm/querysets.py,sha256=Q4iY_TKZItpNnrbCAvlSwyCxJikhaX5qVF3Y2rVgAYQ,1666
|
@@ -23,8 +23,8 @@ rb_commons/schemes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
23
23
|
rb_commons/schemes/jwt.py,sha256=ZKLJ5D3fcEmEKySjzbxEgUcza4K-oPoHr14_Z0r9Yic,2495
|
24
24
|
rb_commons/schemes/pagination.py,sha256=8VZW1wZGJIPR9jEBUgppZUoB4uqP8ORudHkMwvEJSxg,1866
|
25
25
|
rb_commons/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
rb_commons/utils/media.py,sha256=
|
27
|
-
rb_commons-0.7.
|
28
|
-
rb_commons-0.7.
|
29
|
-
rb_commons-0.7.
|
30
|
-
rb_commons-0.7.
|
26
|
+
rb_commons/utils/media.py,sha256=yfOe3L1ZrylZpP-n-pN49UlP9zg7oAuG0BOq7PT-9Cs,1300
|
27
|
+
rb_commons-0.7.9.dist-info/METADATA,sha256=RjUd7-rPdnYlsNjT6ejRUdU1cjQL1K5HtyEUqFYlEqk,6570
|
28
|
+
rb_commons-0.7.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
29
|
+
rb_commons-0.7.9.dist-info/top_level.txt,sha256=HPx_WAYo3_fbg1WCeGHsz3wPGio1ucbnrlm2lmqlJog,11
|
30
|
+
rb_commons-0.7.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|