Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

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 est AccessMgr.

Principe

  1. Tous les secrets vivent dans un fichier JSON externe (hors du dépôt), jamais dans le code source.
  2. Des factory functions (get_kucoin_token, get_telegram_config, get_healthcheck_config, …) lisent ce fichier et créent des objets credential.
  3. 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)

Chemin de configuration par défaut (depuis 0.1.2)

Plutôt que de répéter st_config_path à chaque appel, définissez-le une seule fois au démarrage avec set_default_config_path. Tous les get_*() l'utilisent ensuite automatiquement :

import AccessMgr
from AccessMgr import get_kucoin_token, get_databendo_config, AccessEnvironment

AccessMgr.set_default_config_path("/chemin/vers/access.json")   # une fois au boot

# plus besoin de st_config_path : le défaut est utilisé
kc = get_kucoin_token(st_id="main", an_environment=AccessEnvironment.PROD)

# l'argument explicite reste prioritaire : surcharge ponctuelle (ex. dev)
db = get_databendo_config(st_id="feed", an_environment=AccessEnvironment.DEV,
                          st_sub_name="test", st_config_path="/autre/access_dev.json")

Passer set_default_config_path(None) réinitialise explicitement le comportement (retour aux chemins par défaut codés en dur). Une chaîne vide lève ValueError. L'argument st_config_path d'un appel prime toujours sur le défaut.

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for accessmgr 0.1.2
File Size Uploaded Provenance
accessmgr-0.1.2.tar.gz 15.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for accessmgr 0.1.2
File Interpreter ABI Platform
accessmgr-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 35.6 kB

Release files / accessmgr-0.1.2.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL accessmgr-0.1.2.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
19fc74fce98b9618ff577f2bab2d5aa87f43467547ff73789ce624217c856518
BLAKE2b-256 checksum
How to use checksums
af37a23c28241e6dbe04245cfc18e514f641ce86eab381b0dc31ead9f37cef5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / accessmgr-0.1.2-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL accessmgr-0.1.2-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78834b03e01148f5ee3419f8dd9148917162e41a9802882642eb1ca060f6b576
BLAKE2b-256 checksum
How to use checksums
1aca9bb0c5c7fb374fdb71a2fdc13614c156013bfaaa02cd80f407079f278166
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Security for accessmgr 0.1.2

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.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.1 2 files With provenance
  • Added 0.1.2 2 files Without provenance

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Loss of provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page