accessmgr
Chargement et distribution sécurisés de credentials (mail, Telegram, KuCoin, DataBento, healthcheck) depuis un fichier JSON externe — sans jamais exposer de secret en clair dans le code.
Le nom de distribution est
accessmgr, le package importable estAccessMgr.
Principe
- Tous les secrets vivent dans un fichier JSON externe (hors du dépôt), jamais dans le code source.
- Des factory functions (
get_kucoin_token,get_telegram_config,get_healthcheck_config, …) lisent ce fichier et créent des objets credential. - Les secrets transitent par les variables d'environnement du process et sont
exposés via des propriétés avec contrôle de durée de vie (
duration, en secondes ;-1= permanent).
Installation
pip install accessmgr
Aucune dépendance externe (stdlib uniquement). Python ≥ 3.11.
Format du fichier de configuration (access.json)
Les clés de premier niveau sont des environnements (prod, uat_<nom>, dev_<nom>).
Chaque entrée est préfixée par son type (telegram_, kucoin_, healthcheck_, …).
{
"prod": {
"telegram_myBot": {
"id": "myBot", "type": "telegram", "duration": -1,
"name": "My Bot", "token": "<telegram-bot-token>", "chat_id": "<chat-id>"
},
"healthcheck_nightly": {
"id": "nightly", "type": "healthcheck", "duration": -1,
"name": "nightly job", "uuid": "<healthchecks-uuid>"
}
}
}
⚠️ Ce fichier contient vos secrets : gardez-le hors du dépôt git et à accès restreint.
Utilisation
from AccessMgr import (
get_telegram_config,
get_healthcheck_config,
AccessEnvironment,
)
CONFIG = "/chemin/vers/access.json"
# Telegram
tg = get_telegram_config(st_id="myBot", an_environment=AccessEnvironment.PROD,
st_config_path=CONFIG)
bot_token = tg.token()
chat_id = tg.chat_id()
# Healthcheck (healthchecks.io ou compatible)
hc = get_healthcheck_config(st_id="nightly", an_environment=AccessEnvironment.PROD,
st_config_path=CONFIG)
ping_url = hc.url() # https://hc-ping.com/<uuid> (base = constante du code)
Pour les environnements hors production, un st_sub_name est obligatoire :
cfg = get_telegram_config(st_id="myBot", an_environment=AccessEnvironment.UAT,
st_sub_name="global", st_config_path=CONFIG)
Providers disponibles
| Factory | Type JSON | Retourne |
|---|---|---|
get_mail_config |
mail |
MailLogin (SMTP/IMAP) |
get_telegram_config |
telegram |
ProviderTelegram (token(), chat_id()) |
get_kucoin_token |
kucoin |
ProviderKucoin |
get_massive_data_token |
massivedata |
ProviderMassiveData |
get_databendo_config |
databento |
ProviderDataBendo |
get_healthcheck_config |
healthcheck |
ProviderHealthcheck (url(), uuid()) |
Sécurité
- Aucun secret en clair dans le code source.
- Les secrets transitent : JSON externe →
os.environ→ propriétés avec contrôle d'expiration. - Les objets ne loggent jamais leurs secrets (absents de
repr/str).
Licence
MIT — voir LICENSE.
Metadata
Release files for accessmgr 0.1.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 | |
|---|---|---|---|---|
| accessmgr-0.1.1.tar.gz | 12.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| accessmgr-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.8 kB
Release files / accessmgr-0.1.1.tar.gz
| Download URL | accessmgr-0.1.1.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4a783fdbb41a1faf6bd7963377031649ab6fc4afa9ba122eecf93b37ba49371
|
|
BLAKE2b-256 checksum How to use checksums |
98190320c701854d38860869bc855352f1f67cbb83aec4b509c995fb0ddd2360
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logRelease files / accessmgr-0.1.1-py3-none-any.whl
| Download URL | accessmgr-0.1.1-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06d1d3fac145ea06a109df143ac488bc7901dd94e72646a957b32cc219e0cc90
|
|
BLAKE2b-256 checksum How to use checksums |
36ef4f97719f0b1b5147261599c9891cc04bb980e2ee7d7e5f926ebec9309e0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logSecurity for accessmgr 0.1.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for accessmgr-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.
Transparency logA 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.