## Thư viện Media.
### Cài đặt:
```bash
$ pip3 install mobio-media-sdk
```
#### Log:
- Version: 0.1.1: Thêm mobio token.
- Version: 0.1.2: Add json.dums by func finish_save_file_by_filepath
- Version: 0.1.3: Add func get_path_by_url, get_binary_by_url
+ Hướng dẫn sử dụng:
+ func get_path_by_url -> kết quả trả về là path của url.
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().get_path_by_url(url)
```
+ func get_binary_by_url -> kết quả trả về là binary của url
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().get_binary_by_url(url)
```
- Version: 0.1.4: Add func get_filename_by_url
+ Hướng dẫn sử dụng:
+ func get_filename_by_url -> kết quả trả về là filename của url
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().get_filename_by_url(url)
```
- Version: 0.1.5: Delete system_config
- Version: 0.1.6: Rename get_local_path_by_url -> get_path_by_url
- Version: 0.1.7: Option read file "r" -> "rb"
- Version: 0.1.8: Update lại token call từ Admin
- Version: 0.1.9: Bổ sung tính năng:
- Tạo public link khi chưa có file upload.
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().create_public_url_without_file(
merchant_id="merchant_id",
filename="filename",
mimetype_str="mimetype_str"
)
result = {
'url': '',
'local_path': '',
'filename': ''
}
```
Sau khi xử lý nghiệp vụ xong có thể dùng func sau để Lưu file được lấy path từ URL
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().finish_save_file_by_public_url(filepath="filepath", url="url")
```
- Thêm option **file_byte** khi upload file. Option này phục vụ cho nhu cầu upload file bằng bytes.
- Version: 0.2.0: Bổ sung option display, group_ids
- Version: 0.2.1: Bổ sung merchant_id
- Version: 0.2.2: Sửa từ get public-host từ module media sang module Admin.
- Version: 0.2.2 và 0.2.3: Bổ sung phần tính dung lượng file khi trả về.
- Version: 0.2.5: Chuyển việc lấy public-host sang admin-sdk
- Version: 0.2.6: Apply libs m-kafka-sdk-v2
- Version: 0.2.7: Bỏ m-kafka-sdk
- Version: 0.2.8: Fix lỗi encode url với những tên file đặc biệt
- Version: 0.2.9: Nâng cấp confluent_kafka
- Version: 0.2.10: Thêm get mimetype file_byte
- Version: 0.2.11, 0.2.12: Bổ sung thêm tính năng lưu file định dạng byte
- Version: 0.2.13: Bổ sung thêm phần validate định dạng file upload qua SDK. Nếu không truyền lên thì sẽ lấy mặc định của hệ thống.
- Hướng dẫn sử dụng
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().upload_without_kafka(
merchant_id="",
file_path = '/media/data/folder/tmp/example.jpg',
filename= 'example.jpg',
do_not_delete = True,
extension_isvalid=["png"]
)
result = {
"url": "",
"local_host":"",
"filename": ""
}
```
- Version: 0.2.14: Bổ sung thêm cấu hình kafka_bootstrap_servers trong config, cho phép nhập thông tin kafka_brokers. Nếu không nhập option này sẽ tự động lấy từ ENV KAFKA_BROKERS
- Hướng dẫn sử dụng
```python3
from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK
MobioMediaSDK().config(
redis_uri="",
admin_host="",
cache_prefix="",
kafka_bootstrap_servers=os.environ.get("KAFKA_BROKERS")
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/mobiovn",
"name": "mobio-media-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": null,
"keywords": "mobio, media, upload",
"author": "MOBIO",
"author_email": "contact@mobio.vn",
"download_url": "https://files.pythonhosted.org/packages/69/d8/30f324e922d7660a2e408834f28fcd8ed3b6a031f1ab70d5504dc7bec1de/mobio-media-sdk-0.2.15.tar.gz",
"platform": null,
"description": "## Th\u01b0 vi\u1ec7n Media.\n\n### C\u00e0i \u0111\u1eb7t:\n\n```bash\n $ pip3 install mobio-media-sdk\n ```\n\n#### Log:\n\n- Version: 0.1.1: Th\u00eam mobio token.\n- Version: 0.1.2: Add json.dums by func finish_save_file_by_filepath\n- Version: 0.1.3: Add func get_path_by_url, get_binary_by_url\n + H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng:\n + func get_path_by_url -> k\u1ebft qu\u1ea3 tr\u1ea3 v\u1ec1 l\u00e0 path c\u1ee7a url.\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().get_path_by_url(url)\n ```\n + func get_binary_by_url -> k\u1ebft qu\u1ea3 tr\u1ea3 v\u1ec1 l\u00e0 binary c\u1ee7a url\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().get_binary_by_url(url)\n ```\n- Version: 0.1.4: Add func get_filename_by_url\n + H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng:\n + func get_filename_by_url -> k\u1ebft qu\u1ea3 tr\u1ea3 v\u1ec1 l\u00e0 filename c\u1ee7a url\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().get_filename_by_url(url)\n ```\n- Version: 0.1.5: Delete system_config\n- Version: 0.1.6: Rename get_local_path_by_url -> get_path_by_url\n- Version: 0.1.7: Option read file \"r\" -> \"rb\"\n- Version: 0.1.8: Update l\u1ea1i token call t\u1eeb Admin\n- Version: 0.1.9: B\u1ed5 sung t\u00ednh n\u0103ng:\n - T\u1ea1o public link khi ch\u01b0a c\u00f3 file upload.\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().create_public_url_without_file(\n merchant_id=\"merchant_id\",\n filename=\"filename\",\n mimetype_str=\"mimetype_str\"\n )\n\n result = {\n 'url': '',\n 'local_path': '',\n 'filename': ''\n }\n ```\n Sau khi x\u1eed l\u00fd nghi\u1ec7p v\u1ee5 xong c\u00f3 th\u1ec3 d\u00f9ng func sau \u0111\u1ec3 L\u01b0u file \u0111\u01b0\u1ee3c l\u1ea5y path t\u1eeb URL\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().finish_save_file_by_public_url(filepath=\"filepath\", url=\"url\")\n ```\n - Th\u00eam option **file_byte** khi upload file. Option n\u00e0y ph\u1ee5c v\u1ee5 cho nhu c\u1ea7u upload file b\u1eb1ng bytes.\n\n- Version: 0.2.0: B\u1ed5 sung option display, group_ids\n- Version: 0.2.1: B\u1ed5 sung merchant_id\n- Version: 0.2.2: S\u1eeda t\u1eeb get public-host t\u1eeb module media sang module Admin.\n- Version: 0.2.2 v\u00e0 0.2.3: B\u1ed5 sung ph\u1ea7n t\u00ednh dung l\u01b0\u1ee3ng file khi tr\u1ea3 v\u1ec1.\n- Version: 0.2.5: Chuy\u1ec3n vi\u1ec7c l\u1ea5y public-host sang admin-sdk\n- Version: 0.2.6: Apply libs m-kafka-sdk-v2\n- Version: 0.2.7: B\u1ecf m-kafka-sdk\n- Version: 0.2.8: Fix l\u1ed7i encode url v\u1edbi nh\u1eefng t\u00ean file \u0111\u1eb7c bi\u1ec7t\n- Version: 0.2.9: N\u00e2ng c\u1ea5p confluent_kafka\n- Version: 0.2.10: Th\u00eam get mimetype file_byte\n- Version: 0.2.11, 0.2.12: B\u1ed5 sung th\u00eam t\u00ednh n\u0103ng l\u01b0u file \u0111\u1ecbnh d\u1ea1ng byte\n- Version: 0.2.13: B\u1ed5 sung th\u00eam ph\u1ea7n validate \u0111\u1ecbnh d\u1ea1ng file upload qua SDK. N\u1ebfu kh\u00f4ng truy\u1ec1n l\u00ean th\u00ec s\u1ebd l\u1ea5y m\u1eb7c \u0111\u1ecbnh c\u1ee7a h\u1ec7 th\u1ed1ng.\n - H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().upload_without_kafka(\n merchant_id=\"\",\n file_path = '/media/data/folder/tmp/example.jpg',\n filename= 'example.jpg',\n do_not_delete = True,\n extension_isvalid=[\"png\"]\n )\n\n result = {\n \"url\": \"\",\n \"local_host\":\"\",\n \"filename\": \"\"\n }\n ```\n- Version: 0.2.14: B\u1ed5 sung th\u00eam c\u1ea5u h\u00ecnh kafka_bootstrap_servers trong config, cho ph\u00e9p nh\u1eadp th\u00f4ng tin kafka_brokers. N\u1ebfu kh\u00f4ng nh\u1eadp option n\u00e0y s\u1ebd t\u1ef1 \u0111\u1ed9ng l\u1ea5y t\u1eeb ENV KAFKA_BROKERS\n - H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng\n ```python3\n from mobio.sdks.media.mobio_media_sdk import MobioMediaSDK\n MobioMediaSDK().config(\n redis_uri=\"\",\n admin_host=\"\",\n cache_prefix=\"\",\n kafka_bootstrap_servers=os.environ.get(\"KAFKA_BROKERS\")\n )\n ```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Mobio Media SDK",
"version": "0.2.15",
"project_urls": {
"Homepage": "https://github.com/mobiovn",
"Source": "https://github.com/mobiovn"
},
"split_keywords": [
"mobio",
" media",
" upload"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "69d830f324e922d7660a2e408834f28fcd8ed3b6a031f1ab70d5504dc7bec1de",
"md5": "b1f44ad6ad40e27bec30d2c9eae9918c",
"sha256": "be50c7ebb17c158a042fe7c2e80af0e76f0c5c33c772b284d47afa27adfce8f5"
},
"downloads": -1,
"filename": "mobio-media-sdk-0.2.15.tar.gz",
"has_sig": false,
"md5_digest": "b1f44ad6ad40e27bec30d2c9eae9918c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 24614,
"upload_time": "2024-04-23T00:18:25",
"upload_time_iso_8601": "2024-04-23T00:18:25.604474Z",
"url": "https://files.pythonhosted.org/packages/69/d8/30f324e922d7660a2e408834f28fcd8ed3b6a031f1ab70d5504dc7bec1de/mobio-media-sdk-0.2.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-23 00:18:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mobio-media-sdk"
}