A collection of Python libraries for A360
Project description
a360-python-libraries
Python shared libraries for a360 applications
License
This software is proprietary and is intended solely for use by Aesthetics-360 Inc.. Unauthorized use, distribution, or modification of this software outside of Aesthetics-360 Inc. is strictly prohibited.
Add package into your project
poetry add a360-python-libraries
Usage
Role based access control
from fastapi import APIRouter, Depends
from a360_security.depends import require_role
from a360_security.enums import Role
router = APIRouter()
@router.get(
...,
dependencies=[Depends(require_role(Role.ADMIN))]
)
def get() -> dict:
...
You can provide multiple roles to the require_role
dependency, and they will be checked in OR fashion.
from fastapi import APIRouter, Depends
from a360_security.depends import require_role
from a360_security.enums import Role
router = APIRouter()
@router.get(
...,
dependencies=[Depends(require_role(Role.ADMIN, Role.SERVICE))]
)
def get() -> dict:
...
User valid practice dependency
from fastapi import APIRouter, Depends
from a360_security.depends import valid_practice
router = APIRouter()
@router.get(
...,
dependencies=[Depends(valid_practice())]
)
def get() -> dict:
...
User dependency
from fastapi import APIRouter, Depends
from a360_security.depends import require_user
from a360_security.dto import UserDTO
router = APIRouter()
@router.get(
...,
)
def get(user: UserDTO = Depends(require_user)) -> dict:
...
Client platform
from fastapi import APIRouter, Depends
from a360_security.depends import require_client_platform
from a360_security.enums import ClientPlatform
router = APIRouter()
@router.get(
...,
)
def get(client_platform: ClientPlatform = Depends(require_client_platform)) -> dict:
...
Internal services
from fastapi import APIRouter, Depends
from a360_services import get_dictionary_service
from a360_services.services import DictionaryService
router = APIRouter()
@router.get(
...,
)
def get(dict_service: DictionaryService = Depends(get_dictionary_service)) -> dict:
medical_conditions = dict_service.get_medical_conditions()
Email notification
from fastapi import APIRouter, Depends
from a360_notification import get_mail_service
from a360_notification.services import AWSSesService
router = APIRouter()
@router.post(
...,
)
def create(mail_service: AWSSesService = Depends(get_mail_service)):
mail_service.send_email(
recipient_name='John Doe',
recipient_address='john.doe@example.com',
subject='Test email',
html_content='<h1>Test email</h1>',
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file a360_python_libraries-0.9.0.tar.gz
.
File metadata
- Download URL: a360_python_libraries-0.9.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Linux/6.8.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fab672678522277bd3d4e937f7bb6228e7f68246f5456779d820dc947d13485a |
|
MD5 | 2cdaee0e90dcf82d49eb559db71c6016 |
|
BLAKE2b-256 | d37ac31935f557136429c06e3a59da7eb63fe1b12dddc3a756158701d1ffcc28 |
File details
Details for the file a360_python_libraries-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: a360_python_libraries-0.9.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Linux/6.8.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31a51cf65648c6c3639839f10d0c8e9d326914c59ad14c802becbb8b6608d24d |
|
MD5 | ab677bef369e30db4ba88dd3bc151552 |
|
BLAKE2b-256 | 6a3e18a7cfe47f10458cdc27ab761fe3241c7b1db21d8594d8cfd3a1d5006119 |