## serverless_helpers
This library isn't *required* for writing Python in the [serverless][sls], but
it does make your life easier by handling things like environment variables for
you.
## Usage
```
import serverless_helpers
# all .env files are loaded into the environment
serverless_helpers.load_envs(__file__)
# Loads stack outputs into environment variables as `SERVERLESS_CF_[output name]`
serverless_helpers.load_cfn_outputs()
import os
os.getenv('SERVERLESS_STAGE') # dev
# get role ARN from default serverless CloudFormation stack
os.getenv('SERVERLESS_CF_IamRoleArnLambda') # arn:aws:iam::123456789012:....
# alternate way to read roles
outputs = serverless_helpers.load_cfn_outputs()
outputs['IamRoleArnLambda'] # arn:aws:iam::123456789012:....
```
## License
This code is released under the MIT software license, see LICENSE file for
details. No warranty of any kind is included, and the copyright notice must be
included in redistributions.
*Notable exception*: `dotenv.py` is from
[python-dotenv](https://github.com/theskumar/python-dotenv) to remove
dependencies on click and ordereddict for performance/deployment size reasons.
Read the license contained in `dotenv.py` for details on its creators and
license conditions.
[sls]: http://serverless.com/
This library isn't *required* for writing Python in the [serverless][sls], but
it does make your life easier by handling things like environment variables for
you.
## Usage
```
import serverless_helpers
# all .env files are loaded into the environment
serverless_helpers.load_envs(__file__)
# Loads stack outputs into environment variables as `SERVERLESS_CF_[output name]`
serverless_helpers.load_cfn_outputs()
import os
os.getenv('SERVERLESS_STAGE') # dev
# get role ARN from default serverless CloudFormation stack
os.getenv('SERVERLESS_CF_IamRoleArnLambda') # arn:aws:iam::123456789012:....
# alternate way to read roles
outputs = serverless_helpers.load_cfn_outputs()
outputs['IamRoleArnLambda'] # arn:aws:iam::123456789012:....
```
## License
This code is released under the MIT software license, see LICENSE file for
details. No warranty of any kind is included, and the copyright notice must be
included in redistributions.
*Notable exception*: `dotenv.py` is from
[python-dotenv](https://github.com/theskumar/python-dotenv) to remove
dependencies on click and ordereddict for performance/deployment size reasons.
Read the license contained in `dotenv.py` for details on its creators and
license conditions.
[sls]: http://serverless.com/
Metadata
Release files for serverless_helpers 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| serverless_helpers-0.3.2.tar.gz | 5.5 kB | Details |
Release files / serverless_helpers-0.3.2.tar.gz
| Download URL | serverless_helpers-0.3.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44b7638d892d0776cdc671c7f73c0a256408f105b5e19d3bc220eb209b6cd502
|
|
BLAKE2b-256 checksum How to use checksums |
c45924a727990d90444bc550bcb2da57feca2ee5d62cc14b5189b6be585fbead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |