Skip to main content

No project description provided

Project description

Env parser

Use pip install parsenv

Example

import env

assert env.get("TOKEN") == "abc123"
assert env.get("X", False) is False
assert env.get_int("PORT") == 123
assert env.get_strs("KEYS", []) == ["word1", "F402", "12"]
assert env.get_ints("ADMIN_IDS") == [1, 2, 3]
assert env.get_ints("X", 0) == 0

try:
    env.get("X")
except KeyError as e:
    assert str(e) == "Environment variable `X` not set"

try:
    env.get_ints("BAD_NUMS")
except ValueError as e:
    assert (
            str(e) == "Can't parse environment variable `BAD_NUMS`: "
                      "invalid literal for int() with base 10: 'a'"
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parsenv-0.1.4.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

parsenv-0.1.4-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file parsenv-0.1.4.tar.gz.

File metadata

  • Download URL: parsenv-0.1.4.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.9 CPython/3.10.5

File hashes

Hashes for parsenv-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4bd860185ef995a8b491a58dacd392c3906a92c5e8b98dc0988c4689fe1cd7b1
MD5 d949066f598ef5a82fbf5c95682e4085
BLAKE2b-256 d212dc0340e307126c586bed05c3b032b873ef011e1ddf2d12352a30d55e6ffc

See more details on using hashes here.

File details

Details for the file parsenv-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: parsenv-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.9 CPython/3.10.5

File hashes

Hashes for parsenv-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e332853ac2bb49e9a1ef6675be6b40f57bcf00815cf157bbee44ca21ce1ac380
MD5 cd496cf6cabb2f29d13f0c7a096b5e77
BLAKE2b-256 dc8c2c83e6b5df699feae2853b689fdc9339b378d5acfd499d1d16fc5e80dc32

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page