Accessing Environment Variables with Python 3

Background

Soon I’ll be adding support for environment variables into a side-project of mine: https://gitlab.com/chicken231/eat-a-py.

Here is a simple way to define a list of environment variables you want to capture by name, and return the name and their value as a pretty dictionary.

Code

  • Link to Python code snippet: https://gitlab.com/snippets/1731184

References

  • https://stackoverflow.com/questions/4906977/how-do-i-access-environment-variables-from-python

This is a preview of Clap Button, a new feedback and analytics tools for Hydejack, built by yours truly. You can try it out on localhost for free, but it will be removed (together with this message) when building with JEKYLL_ENV=production. To use Clap Button on your site, get a subscription
and set clap_button: true in your config file.


© 2021. All rights reserved.