Skip to main content

No project description provided

Project description

Env parser

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.2.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

parsenv-0.1.2-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: parsenv-0.1.2.tar.gz
  • Upload date:
  • Size: 1.9 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.2.tar.gz
Algorithm Hash digest
SHA256 dbdb9e976e1f05dae0a6e37f785903c97cba91ead99c7fdc42d20c79ea2ed859
MD5 b1e123601f975e124b5f2e66b7b4afb3
BLAKE2b-256 5e6cfc4386db4d1bf4c1b769cf52e5a8ee897e626cdf41ef5391877c8e70e854

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parsenv-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 39c0ed5c087c0d3eb35bb6c205f77a4a7ab6c7bcc74716b403bd45480cbaf728
MD5 78889c8cc09621b2599443cf15dd6ecf
BLAKE2b-256 d7a65ecdcee027c0f07c50b36d2f2f7ccf44e2b96769f56e67eb6c1feb173f62

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