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.8.tar.gz
.
File metadata
- Download URL: a360_python_libraries-0.9.8.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d879544dd93710975dcad3a05f2e85dfea175a9a9f9e07cc277312d3582ee6a0 |
|
MD5 | 37b2340274501cc4aefb53a435f5719e |
|
BLAKE2b-256 | 9a21a31ce07bd5871d8038f24bbec341150df8279191bd878f7bea8ea7a2a3bb |
File details
Details for the file a360_python_libraries-0.9.8-py3-none-any.whl
.
File metadata
- Download URL: a360_python_libraries-0.9.8-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.10 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 175eb138c76979144a0510915fa5b05d3c10768a541989114a2f34d40608f618 |
|
MD5 | 8e205aafc87470717187e458d49fa53f |
|
BLAKE2b-256 | 58e945eff023c07621e53ff99d918f747f236eac8208bb6f0d886e94b2759e8c |