swag-api
This is the API for the swag-client account metadata service.
Quickstart
Frontend
- Change directories to the
staticdirectory and runnpm install npm start
Backend
pip install -e .swag-api run
Metrics Plugins
To create a custom metrics plugin, you will need to do the following:
-
Create the following directory structure under
swag_api/plugins/metrics:swag_api/plugins/metrics/ ├── ... └── your_plugin_here ├── __init__.py └── module.py -
A sample plugin is provided in
swag_api/plugins/metrics/sample. You can enable the sample plugin by setting the Flask configurationENABLE_SAMPLE_METRICS_PLUGINset toTrue. -
In your
module.pyyou will need to write your plugin to subclass theMetricsPluginfound inswag_api/plugins/metrics/__init__.py.The base class has 2 functions that you need to overwrite:
send_counter_metric, andsend_latency_metric. Thecounter_metricis a metric for counting how many times an API is hit. Thelatency_metricis used to gauge the total time it takes to process a given API call. -
Once you have implemented the
module.py, in your package's__init__.py, you will need to import your pluginas MetricsPlugin. See the sample plugin's__init__.pyfor an example. -
You can have multiple metrics plugins enabled should you want!
swag-apiwill look for them on startup and initialize them. Feel free to add any initialization code you need in your class's__init__().
Metadata
Release files for swag-api 0.0.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 |
|---|---|---|---|---|
| swag-api-0.0.1.tar.gz | 18.2 kB | Without provenance | Details for swag-api-0.0.1.tar.gz |
Release files / swag-api-0.0.1.tar.gz
| Download URL | swag-api-0.0.1.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0090f52142df6c2aab00dc3b741a16666f3017b945b9cd427b5eea902096112
|
|
BLAKE2b-256 checksum How to use checksums |
40ddab4f07c7453e0fe753e2bf0c94945d0f3f5b1143e2e30a6851166e97ac7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
|
Security for swag-api 0.0.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.