Skip to main content

A collection of Python libraries for A360

Project description

a360-python-libraries

Python shared libraries for a360 applications

Preparation

Prepare GitHub access

To have access to Docker images registry on GitHub, you should create an access token at GitHub profile settings / Developer tools / Access tokens with permission read:packages

After that, put your GitHub username and token into .env file at project root directory:

GITHUB_USER=username
GITHUB_TOKEN=token

Login to your GitHub registry

make login

Add package into your project

Add the following line into your pyproject.toml file:

a360-python-libraries = { git = "git@github.com:aesthetics-360/a360-python-libraries.git", tag = "0.2.0" }

and run:

make build

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:
    ...

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:
    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a360_python_libraries-0.3.6.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

a360_python_libraries-0.3.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file a360_python_libraries-0.3.6.tar.gz.

File metadata

  • Download URL: a360_python_libraries-0.3.6.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

File hashes

Hashes for a360_python_libraries-0.3.6.tar.gz
Algorithm Hash digest
SHA256 93b099835f8617292927ffbedbfcacd68a00beea48981c2fcc8a261498527b36
MD5 97b28fcac6aaf25fc5d7797eee0cb3c2
BLAKE2b-256 adca416957018b30a29793c2ae97525e245b9e78a94a96fbba086d099c1999bf

See more details on using hashes here.

File details

Details for the file a360_python_libraries-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for a360_python_libraries-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a8bd1bbaab8f5c64aaf2fc7da6b4b988c8936256e0c59142667a993947f2236e
MD5 d3b7600e4733e95dace32bc6a9d6ddec
BLAKE2b-256 8dd3ba9c1fa3abd6f5d955f09c5abe7268d89e141bb31c6942d0c9e6d511357e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page