ZOG Utils
Utilities to use in my base-api project template. https://github.com/tienhm0202/base-fastapi/
Why ZOG? Because I can't named it as utils only, so I have to add a prefix.
ZOG sounds like joke and looks like zoo. I found that funny enough to use.
Usage
$ pip install zogutils
To generate short unique id string
from zogutils import secret
secret.unique_id(8, "ID_")
# return: ID_a7uFg9k0
To shorten package name like Java's Logback
from zogutils import package_name
package_name.shorten("company.scope.modules.Function", 9)
# return: (something like) c.s.m.Function - depends on max length
To init some middlewares
from zogutils import middlewares
from your.app import settings, fastapi_app
middlewares.init_app(fastapi_app, settings)
Configs:
# Sentry
SENTRY_DSN: Optional[HttpUrl] = None
SENTRY_INCLUDE: Optional[List[str]] = ["src"]
SENTRY_SAMPLE_RATE: Optional[float] = 0.5
# CSRF
SECURITY_CSRF: bool = False
# Rate limit
RATE_LIMIT: int = 100
RATE_LIMIT_TIME_SPAN: int = 30
RATE_LIMIT_BLOCK_DURATION: int = 300
# Prometheus
PROMETHEUS_ENABLE: bool = True
PROMETHEUS_PATH: str = "/metrics/"
# Cors
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = []
Metadata
Release files for zogutils 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zogutils-1.5.1.tar.gz | 5.1 kB | Without provenance | Details for zogutils-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zogutils-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for zogutils-1.5.1-py3-none-any.whl |
Total release size: 11.3 kB
Release files / zogutils-1.5.1.tar.gz
| Download URL | zogutils-1.5.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30573bcb88581b00e29adfb43f41ec9b20f663659c92d9afff2133365168e716
|
|
BLAKE2b-256 checksum How to use checksums |
6cc374640a4b7a415ee031ec1dfb1ffec0be13037d4d2a6b01cca573dbafa45a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/20.2.0
|
Release files / zogutils-1.5.1-py3-none-any.whl
| Download URL | zogutils-1.5.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
356db3f977cf30d0a32a1aff481463c8768844080d81bd81ecc478c3abe9b47d
|
|
BLAKE2b-256 checksum How to use checksums |
45748c5f073368314313ab18cac787a6dc472133535a2efefafe0038dde5dd3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.8.6 Darwin/20.2.0
|
Security for zogutils 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.