Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
The `abstract_security` module is a Python utility that provides functionality for managing environment variables and securely loading sensitive information from `.env` files. It is designed to simplify the process of accessing and managing environment variables within your Python applications.
The abstract_security
module is a Python utility that provides functionality for managing environment variables and securely loading sensitive information from .env
files. It is designed to simplify the process of accessing and managing environment variables within your Python applications.
.env
File Location: Searches for .env
files in current working directory, home directory, and a special .envy_all
directory within the home directory.Install abstract_security
using pip:
pip install abstract-security
Here's a simple example to get started:
from abstract_security import get_env_value
env_key = 'YOUR_ENV_VARIABLE_KEY'
value = get_env_value(key=env_key)
The AbstractEnv
class can be used for more advanced scenarios, including custom paths and file names for the .env
file.
from abstract_security import AbstractEnv
# Initialize with custom parameters
abstract_env = AbstractEnv(key='YOUR_ENV_VARIABLE_KEY', file_name='custom.env', path='/custom/path')
value = abstract_env.env_value
##Functions
AbstractEnv
ClassThe AbstractEnv
class allows you to manage environment variables and securely load values from a .env
file. Here's how to use it:
AbstractEnv
Object# Create an AbstractEnv object with default settings
abstract_env = AbstractEnv()
You can also customize the initialization by specifying the key, file name, and path as follows:
# Custom initialization
abstract_env = AbstractEnv(key='MY_PASSWORD', file_name='.env', path='/path/to/.env')
You can retrieve the value of a specific environment variable using the get_env_value
method of the AbstractEnv
object:
# Retrieve the value of a specific environment variable
value = abstract_env.get_env_value(key='YOUR_ENV_VARIABLE')
get_env_value
FunctionAlternatively, you can use the get_env_value
function to directly retrieve the value of an environment variable without creating an AbstractEnv
object:
from abstract_security import get_env_value
# Retrieve the value of a specific environment variable
value = get_env_value(key='YOUR_ENV_VARIABLE', path='/path/to/.env')
AbstractEnv
ClassAbstractEnv(key='MY_PASSWORD', file_name='.env', path=os.getcwd())
Initializes an AbstractEnv
object to manage environment variables.
key
(str, optional): The key to search for in the .env
file. Defaults to 'MY_PASSWORD'.file_name
(str, optional): The name of the .env
file. Defaults to '.env'.path
(str, optional): The path where the .env
file is located. Defaults to the current working directory.re_initialize(key='MY_PASSWORD', file_name='.env', path=os.getcwd())
Re-initializes an AbstractEnv
object with new settings.
key
(str, optional): The key to search for in the .env
file. Defaults to 'MY_PASSWORD'.file_name
(str, optional): The name of the .env
file. Defaults to '.env'.path
(str, optional): The path where the .env
file is located. Defaults to the current working directory.get_env_value(key='MY_PASSWORD', path=os.getcwd(), file_name='.env')
Retrieves the value of the specified environment variable.
key
(str): The key to search for in the .env
file.path
(str): The path to the environment file.file_name
(str): The name of the environment file.get_env_value
Functionget_env_value(key=None, path=None, file_name=None)
Retrieves the value of a specified environment variable from a .env
file.
key
(str, optional): The key to search for in the .env
file. Defaults to None.path
(str, optional): The path to the .env
file. Defaults to None.file_name
(str, optional): The name of the .env
file. Defaults to None.This module is distributed under the MIT License.
For more information and usage examples, please refer to the GitHub repository and PyPI package.
If you encounter any issues or have questions, feel free to open an issue on GitHub or contact the author, putkoff, for assistance.
Author: putkoff
Email: partners@abstractendeavors.com
Project Link: https://github.com/AbstractEndeavors/abstract_security
FAQs
The `abstract_security` module is a Python utility that provides functionality for managing environment variables and securely loading sensitive information from `.env` files. It is designed to simplify the process of accessing and managing environment variables within your Python applications.
We found that abstract-security demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.