# Env2
os.environ on stereoids
env2 allows raising errors on missing environment variables without too much bolierplate code. This is very useful when developing microservices that depends on environment variables.
## How it works
With env2 you can replace this:
```python
import os
var = os.environ.get('key', None)
if not var:
raise Exception(f'{key} not found in environment variables')
return var
```
With this:
```python
from env2 import env2
var = env2('key')
```
env2 will automatically raise on a missing key, to avoid that:
```python
from env2 import env2
var = env2('key', raise_error=False)
```
env2 allows to set default values as well:
```python
from env2 import env2
var = env2('key', default='key2')
```
## License
This software is under [WTFPL](http://www.wtfpl.net) license
os.environ on stereoids
env2 allows raising errors on missing environment variables without too much bolierplate code. This is very useful when developing microservices that depends on environment variables.
## How it works
With env2 you can replace this:
```python
import os
var = os.environ.get('key', None)
if not var:
raise Exception(f'{key} not found in environment variables')
return var
```
With this:
```python
from env2 import env2
var = env2('key')
```
env2 will automatically raise on a missing key, to avoid that:
```python
from env2 import env2
var = env2('key', raise_error=False)
```
env2 allows to set default values as well:
```python
from env2 import env2
var = env2('key', default='key2')
```
## License
This software is under [WTFPL](http://www.wtfpl.net) license
Metadata
Release files for env2 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| env2-0.0.0.tar.gz | 2.9 kB | Details |
Release files / env2-0.0.0.tar.gz
| Download URL | env2-0.0.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34b54bf1636069cbb6266a278226d26d84d1ade736a4c36f4340664394a7ae2f
|
|
BLAKE2b-256 checksum How to use checksums |
962263b196fbb1cb4dabf408797c550efd59d3c241a04b663052a3ad1c1d11e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |