Skip to main content

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)

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

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

Source distribution (sdist)

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

Built distribution (wheel)

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

Total release size: 32.9 kB

Release files / accessmgr-0.1.0.tar.gz

Download URL accessmgr-0.1.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e20c7eb32e5844aa98992a8c2001e2b224bbd6462ea1d04f1c7d73ff7325a175
BLAKE2b-256 checksum
How to use checksums
170335c75954abe51dd6abcb1f457e7625c4d5e562200bd9635e607450856a79
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.0-py3-none-any.whl

Download URL accessmgr-0.1.0-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2fc27134dde15c1a7edaa9bd1cc64668833907f0812656e24d989c30345df30
BLAKE2b-256 checksum
How to use checksums
4233033ab4427b2223badcc555d7b3edc0af39b40e1a6f83ee6d52f02fd25ce7
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.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No 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