Yet another environment parser.
Project description
envanter
Yet another environment parser.
Usage
>>> from envanter import env
>>> env.str("SOME_STRING")
'my string'
>>> env.int("SOME_INTEGER")
7
>>> env.float("SOME_FLOAT")
3.14
>>> env.decimal("SOME_DECIMAL")
decimal.Decimal("2.71")
>>> env.json("SOME_JSON")
{"hello": "world"}
>>> env.bool("some-bool")
True
>>> env.bool("some-bool-but-wrong-keyword")
AssertionError: Allowed values are: ('true', '1', 'false', '0')
>>> env.str("nothing", "something")
'something'
>>> env.str("nothing")
KeyError: 'nothing'
Custom parser function
>>> from envanter import env
>>> from urllib.parse import urlparse
>>> env.parse("SOME_URL", parser=urlparse)
ParseResult(scheme='', netloc='', path='www.example.com', params='', query='', fragment='')
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
envanter-1.0.0.tar.gz
(3.4 kB
view hashes)