abstract-security


Nameabstract-security JSON
Version 0.63 PyPI version JSON
download
home_pagehttps://github.com/AbstractEndeavors/abstract_security
SummaryThe `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.
upload_time2024-11-22 08:06:02
maintainerNone
docs_urlNone
authorputkoff
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Abstract Security

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.

## Table of Contents

- [Features](#features)
- [Installation](#installationn)
- [Usage](#usage)
- [Functions](#functions)
- [License](#license)
- [Contact](#contact)

### Features
- **Flexible `.env` File Location**: Searches for `.env` files in current working directory, home directory, and a special `.envy_all` directory within the home directory.
- **Clean and Secure Key Retrieval**: Offers functionality to cleanly split strings at equals signs and safely retrieve environment variable values.

## Installation

Install `abstract_security` using pip:

```bash
pip install abstract-security
```

## Usage

### Basic Usage
Here's a simple example to get started:

```python
from abstract_security import get_env_value

env_key = 'YOUR_ENV_VARIABLE_KEY'
value = get_env_value(key=env_key)
```

### Advanced Usage
The `AbstractEnv` class can be used for more advanced scenarios, including custom paths and file names for the `.env` file.

```python
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` Class

The `AbstractEnv` class allows you to manage environment variables and securely load values from a `.env` file. Here's how to use it:

#### Initializing an `AbstractEnv` Object

```python
# 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:

```python
# Custom initialization
abstract_env = AbstractEnv(key='MY_PASSWORD', file_name='.env', path='/path/to/.env')
```

#### Getting Environment Variable Values

You can retrieve the value of a specific environment variable using the `get_env_value` method of the `AbstractEnv` object:

```python
# Retrieve the value of a specific environment variable
value = abstract_env.get_env_value(key='YOUR_ENV_VARIABLE')
```

### `get_env_value` Function

Alternatively, you can use the `get_env_value` function to directly retrieve the value of an environment variable without creating an `AbstractEnv` object:

```python
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')
```

## API Reference

### `AbstractEnv` Class

#### `AbstractEnv(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` Function

#### `get_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.

## License

This module is distributed under the [MIT License](LICENSE).

---

For more information and usage examples, please refer to the [GitHub repository](https://github.com/AbstractEndeavors/abstract_security) and [PyPI package](https://pypi.org/project/abstract-security/).

If you encounter any issues or have questions, feel free to open an issue on GitHub or contact the author, putkoff, for assistance.
## Contact

**Author**: putkoff  
**Email**: partners@abstractendeavors.com  
**Project Link**: [https://github.com/AbstractEndeavors/abstract_security](https://github.com/AbstractEndeavors/abstract_security)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AbstractEndeavors/abstract_security",
    "name": "abstract-security",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "putkoff",
    "author_email": "partners@abstractendeavors.com",
    "download_url": "https://files.pythonhosted.org/packages/c6/f3/deb9d11c1d6a1f696e5380c2ff67b4b5de352c303113c947de87dd75f986/abstract_security-0.63.tar.gz",
    "platform": null,
    "description": "## Abstract Security\n\nThe `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.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installationn)\n- [Usage](#usage)\n- [Functions](#functions)\n- [License](#license)\n- [Contact](#contact)\n\n### Features\n- **Flexible `.env` File Location**: Searches for `.env` files in current working directory, home directory, and a special `.envy_all` directory within the home directory.\n- **Clean and Secure Key Retrieval**: Offers functionality to cleanly split strings at equals signs and safely retrieve environment variable values.\n\n## Installation\n\nInstall `abstract_security` using pip:\n\n```bash\npip install abstract-security\n```\n\n## Usage\n\n### Basic Usage\nHere's a simple example to get started:\n\n```python\nfrom abstract_security import get_env_value\n\nenv_key = 'YOUR_ENV_VARIABLE_KEY'\nvalue = get_env_value(key=env_key)\n```\n\n### Advanced Usage\nThe `AbstractEnv` class can be used for more advanced scenarios, including custom paths and file names for the `.env` file.\n\n```python\nfrom abstract_security import AbstractEnv\n\n# Initialize with custom parameters\nabstract_env = AbstractEnv(key='YOUR_ENV_VARIABLE_KEY', file_name='custom.env', path='/custom/path')\nvalue = abstract_env.env_value\n```\n\n##Functions \n\n### `AbstractEnv` Class\n\nThe `AbstractEnv` class allows you to manage environment variables and securely load values from a `.env` file. Here's how to use it:\n\n#### Initializing an `AbstractEnv` Object\n\n```python\n# Create an AbstractEnv object with default settings\nabstract_env = AbstractEnv()\n```\n\nYou can also customize the initialization by specifying the key, file name, and path as follows:\n\n```python\n# Custom initialization\nabstract_env = AbstractEnv(key='MY_PASSWORD', file_name='.env', path='/path/to/.env')\n```\n\n#### Getting Environment Variable Values\n\nYou can retrieve the value of a specific environment variable using the `get_env_value` method of the `AbstractEnv` object:\n\n```python\n# Retrieve the value of a specific environment variable\nvalue = abstract_env.get_env_value(key='YOUR_ENV_VARIABLE')\n```\n\n### `get_env_value` Function\n\nAlternatively, you can use the `get_env_value` function to directly retrieve the value of an environment variable without creating an `AbstractEnv` object:\n\n```python\nfrom abstract_security import get_env_value\n\n# Retrieve the value of a specific environment variable\nvalue = get_env_value(key='YOUR_ENV_VARIABLE', path='/path/to/.env')\n```\n\n## API Reference\n\n### `AbstractEnv` Class\n\n#### `AbstractEnv(key='MY_PASSWORD', file_name='.env', path=os.getcwd())`\n\nInitializes an `AbstractEnv` object to manage environment variables.\n\n- `key` (str, optional): The key to search for in the `.env` file. Defaults to 'MY_PASSWORD'.\n- `file_name` (str, optional): The name of the `.env` file. Defaults to '.env'.\n- `path` (str, optional): The path where the `.env` file is located. Defaults to the current working directory.\n\n#### `re_initialize(key='MY_PASSWORD', file_name='.env', path=os.getcwd())`\n\nRe-initializes an `AbstractEnv` object with new settings.\n\n- `key` (str, optional): The key to search for in the `.env` file. Defaults to 'MY_PASSWORD'.\n- `file_name` (str, optional): The name of the `.env` file. Defaults to '.env'.\n- `path` (str, optional): The path where the `.env` file is located. Defaults to the current working directory.\n\n#### `get_env_value(key='MY_PASSWORD', path=os.getcwd(), file_name='.env')`\n\nRetrieves the value of the specified environment variable.\n\n- `key` (str): The key to search for in the `.env` file.\n- `path` (str): The path to the environment file.\n- `file_name` (str): The name of the environment file.\n\n### `get_env_value` Function\n\n#### `get_env_value(key=None, path=None, file_name=None)`\n\nRetrieves the value of a specified environment variable from a `.env` file.\n\n- `key` (str, optional): The key to search for in the `.env` file. Defaults to None.\n- `path` (str, optional): The path to the `.env` file. Defaults to None.\n- `file_name` (str, optional): The name of the `.env` file. Defaults to None.\n\n## License\n\nThis module is distributed under the [MIT License](LICENSE).\n\n---\n\nFor more information and usage examples, please refer to the [GitHub repository](https://github.com/AbstractEndeavors/abstract_security) and [PyPI package](https://pypi.org/project/abstract-security/).\n\nIf you encounter any issues or have questions, feel free to open an issue on GitHub or contact the author, putkoff, for assistance.\n## Contact\n\n**Author**: putkoff  \n**Email**: partners@abstractendeavors.com  \n**Project Link**: [https://github.com/AbstractEndeavors/abstract_security](https://github.com/AbstractEndeavors/abstract_security)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "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.",
    "version": "0.63",
    "project_urls": {
        "Homepage": "https://github.com/AbstractEndeavors/abstract_security"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fdd683bd237d1baba45a6a8027274511dec755ba2dec255855661477316790c1",
                "md5": "b839a5dfc52867c6b9f366776f1a2747",
                "sha256": "bfa9f1f4a67ba07821ee07b365074482d6888ba863590ce976ce655d3ccf8a0d"
            },
            "downloads": -1,
            "filename": "abstract_security-0.63-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b839a5dfc52867c6b9f366776f1a2747",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7237,
            "upload_time": "2024-11-22T08:06:01",
            "upload_time_iso_8601": "2024-11-22T08:06:01.123488Z",
            "url": "https://files.pythonhosted.org/packages/fd/d6/83bd237d1baba45a6a8027274511dec755ba2dec255855661477316790c1/abstract_security-0.63-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6f3deb9d11c1d6a1f696e5380c2ff67b4b5de352c303113c947de87dd75f986",
                "md5": "832f3eb63379c80f17ea57acb02734cc",
                "sha256": "bd95b5ecebd3a6a3c368fe02fc5a4d5841b10123af88daa9cb0f6522b4bfc53d"
            },
            "downloads": -1,
            "filename": "abstract_security-0.63.tar.gz",
            "has_sig": false,
            "md5_digest": "832f3eb63379c80f17ea57acb02734cc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7503,
            "upload_time": "2024-11-22T08:06:02",
            "upload_time_iso_8601": "2024-11-22T08:06:02.005882Z",
            "url": "https://files.pythonhosted.org/packages/c6/f3/deb9d11c1d6a1f696e5380c2ff67b4b5de352c303113c947de87dd75f986/abstract_security-0.63.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-22 08:06:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AbstractEndeavors",
    "github_project": "abstract_security",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "abstract-security"
}
        
Elapsed time: 0.36541s