Skip to content

os.environ['value'] support #137

@mihaaairu

Description

@mihaaairu

That would be great to extend current syntaxis with standart python dictionary's.

For now we can work with .env vars like this: os.getenv('value') or os.environ.get('value').
But .get() methods handles KeyError exceptions, so, we can't autocheck .env file correctness.

All we can do is to write smth like that:

foo = os.getenv('bar', None)
if foo is None:
    raise KeyError('bar')

But, this of cource this ruins the code clearness/elegancy.

So, the main idea is to extend support for python dictionary syntaxis, which will looks like that: os.environ['value'].
This syntax will throw the exception in case of incorrect .env key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions