## Saas MS Library
Saas MS Library is a Python library designed to be a utility for OMS microservices. This library provides an easy-to-use and highly customizable solution for reusing application utilities and clients, allowing developers to focus on creating the most efficient and scalable microservice.
With Saas MS Library, you will be able to handle AWS databases and clients. Our library is compatible with Python 3.10 and later versions, and is under constant development to improve its performance and extend its functionality.
#### Features
1. Database Handler (MongoDB, Redis, PostgreSQL, etc.)
2. AWS Client Handler (Cognito, S3, etc.)
3. Decorators
#### Installation
To install saas-ms-library, simply run the following command:
```
pip install saas-ms-library
```
#### Examples of use
Here are some examples of how to use saas-ms-library in your projects:
Create environment variables
```
GRPC_PORT=50051
GRPC_MAX_WORKERS=10
SERVICE_ID=saas-ms-user
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0
```
Use
```
from protos.v1.users import user_pb2, user_pb2_grpc
from omni.pro.decorators import resources_decorator
from omni.pro.util import HTTPStatus, Resource, deep_search, nested
class UserService(user_pb2_grpc.UsersServiceServicer):
@resources_decorator([Resource.AWS_COGNITO, Resource.MONGODB])
def UserCreate(
self, request: user_pb2.UserCreateRequest, context
) -> user_pb2.UserCreateResponse:
response = context.cognito_client.create_user(
username=data["username"],
password=data["password"],
name=data["name"],
email=data["email"],
tenant=data["tenant"],
language_code=data["language"]["code"],
timezone_code=data["timezone"]["code"],
)
att_list = nested(response, "User.Attributes") or nested(response, "UserAttributes", default=[])
sub_dict = deep_search(att_list, key, value)
user = context.db_manager.get_document(
context.db_name, UserDocument, sub=sub_dict.get("Value")
)
return user_pb2.UserCreateResponse(
response_standard=base_pb2.ResponseStandard(
success=True,
message="User created",
status_code=HTTPStatus.CREATED
),
user=user.to_proto(),
)
```
#### License
Saas MS Library is licensed under the modified MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/Omnipro-Solutions/saas-ms-library",
"name": "omni-pro",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "",
"author": "OMNI.PRO",
"author_email": "development@omni.pro",
"download_url": "https://files.pythonhosted.org/packages/01/fe/5802345d7eb4dc38dc97e0bf2c1fb788f27ff8254af657d8105ea2446c8e/omni-pro-0.1.226.tar.gz",
"platform": null,
"description": "## Saas MS Library\n\nSaas MS Library is a Python library designed to be a utility for OMS microservices. This library provides an easy-to-use and highly customizable solution for reusing application utilities and clients, allowing developers to focus on creating the most efficient and scalable microservice.\n\nWith Saas MS Library, you will be able to handle AWS databases and clients. Our library is compatible with Python 3.10 and later versions, and is under constant development to improve its performance and extend its functionality.\n\n#### Features\n1. Database Handler (MongoDB, Redis, PostgreSQL, etc.)\n2. AWS Client Handler (Cognito, S3, etc.)\n3. Decorators\n\n#### Installation\nTo install saas-ms-library, simply run the following command:\n```\npip install saas-ms-library\n\n```\n\n#### Examples of use\nHere are some examples of how to use saas-ms-library in your projects:\n\nCreate environment variables\n```\nGRPC_PORT=50051\nGRPC_MAX_WORKERS=10\nSERVICE_ID=saas-ms-user\nREDIS_HOST=redis\nREDIS_PORT=6379\nREDIS_DB=0\n```\nUse\n```\nfrom protos.v1.users import user_pb2, user_pb2_grpc\nfrom omni.pro.decorators import resources_decorator\nfrom omni.pro.util import HTTPStatus, Resource, deep_search, nested\n\n\nclass UserService(user_pb2_grpc.UsersServiceServicer):\n @resources_decorator([Resource.AWS_COGNITO, Resource.MONGODB])\n def UserCreate(\n self, request: user_pb2.UserCreateRequest, context\n ) -> user_pb2.UserCreateResponse:\n response = context.cognito_client.create_user(\n username=data[\"username\"],\n password=data[\"password\"],\n name=data[\"name\"],\n email=data[\"email\"],\n tenant=data[\"tenant\"],\n language_code=data[\"language\"][\"code\"],\n timezone_code=data[\"timezone\"][\"code\"],\n )\n att_list = nested(response, \"User.Attributes\") or nested(response, \"UserAttributes\", default=[])\n sub_dict = deep_search(att_list, key, value)\n user = context.db_manager.get_document(\n context.db_name, UserDocument, sub=sub_dict.get(\"Value\")\n )\n return user_pb2.UserCreateResponse(\n response_standard=base_pb2.ResponseStandard(\n success=True,\n message=\"User created\",\n status_code=HTTPStatus.CREATED\n ),\n user=user.to_proto(),\n )\n```\n\n#### License\nSaas MS Library is licensed under the modified MIT License.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python library designed to be a utility for OMS microservices",
"version": "0.1.226",
"project_urls": {
"Homepage": "https://github.com/Omnipro-Solutions/saas-ms-library"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "edc6780d5ba2e7ff382b2fa2bf67097a75466343a9f5161d10ae22b309ebfdc4",
"md5": "edbc8a47068a948f71f73fccaaaa9454",
"sha256": "c53be7d63e01798615b291f6a803ad25a175c8d372ae5ce266b13fbe54fefe79"
},
"downloads": -1,
"filename": "omni_pro-0.1.226-py3-none-any.whl",
"has_sig": false,
"md5_digest": "edbc8a47068a948f71f73fccaaaa9454",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 551296,
"upload_time": "2024-02-13T16:25:46",
"upload_time_iso_8601": "2024-02-13T16:25:46.230368Z",
"url": "https://files.pythonhosted.org/packages/ed/c6/780d5ba2e7ff382b2fa2bf67097a75466343a9f5161d10ae22b309ebfdc4/omni_pro-0.1.226-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "01fe5802345d7eb4dc38dc97e0bf2c1fb788f27ff8254af657d8105ea2446c8e",
"md5": "abd5da1e59fa1eb5aae8482c305ae49b",
"sha256": "15c49eaa49ff9b7b8c5eff184b9868f1943ae08318e4bf0db3ea2dade3077f97"
},
"downloads": -1,
"filename": "omni-pro-0.1.226.tar.gz",
"has_sig": false,
"md5_digest": "abd5da1e59fa1eb5aae8482c305ae49b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 255242,
"upload_time": "2024-02-13T16:25:51",
"upload_time_iso_8601": "2024-02-13T16:25:51.226589Z",
"url": "https://files.pythonhosted.org/packages/01/fe/5802345d7eb4dc38dc97e0bf2c1fb788f27ff8254af657d8105ea2446c8e/omni-pro-0.1.226.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-13 16:25:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Omnipro-Solutions",
"github_project": "saas-ms-library",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "omni-pro"
}