{"id":23223061,"url":"https://github.com/andrei-demidov/django-simple-secrets","last_synced_at":"2026-01-24T09:33:40.337Z","repository":{"id":259645874,"uuid":"879105135","full_name":"efficient-solutions/django-simple-secrets","owner":"efficient-solutions","description":"Django integration for AWS Secrets Manager","archived":false,"fork":false,"pushed_at":"2024-10-27T02:12:00.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-10-27T04:22:49.674Z","etag":null,"topics":["aws-secrets-manager","django","django-secret-key","django-security","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/efficient-solutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T01:44:36.000Z","updated_at":"2024-10-27T02:12:03.000Z","dependencies_parsed_at":"2024-10-27T04:38:43.483Z","dependency_job_id":null,"html_url":"https://github.com/efficient-solutions/django-simple-secrets","commit_stats":null,"previous_names":["efficient-solutions/django-simple-secrets"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efficient-solutions%2Fdjango-simple-secrets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efficient-solutions%2Fdjango-simple-secrets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efficient-solutions%2Fdjango-simple-secrets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efficient-solutions%2Fdjango-simple-secrets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efficient-solutions","download_url":"https://codeload.github.com/efficient-solutions/django-simple-secrets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230351135,"owners_count":18212790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-secrets-manager","django","django-secret-key","django-security","python"],"created_at":"2024-12-18T23:15:54.756Z","updated_at":"2025-08-19T11:32:46.553Z","avatar_url":"https://github.com/efficient-solutions.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Simple Secrets\n\nA Django integration for AWS Secrets Manager with caching and lazy loading support.\n\n[![Python 3.10+](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![Django 4.x/5.x](https://img.shields.io/badge/Django-4.x|5.x-green.svg)](https://www.djangoproject.com/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/efficient-solutions/django-simple-secrets/blob/main/LICENSE)\n\n## Overview\n\n`django-simple-secrets` provides a clean and efficient way to access AWS Secrets Manager from a Django applications. It features built-in caching to reduce API calls and supports lazy loading of secrets through Django's `SimpleLazyObject`.\n\n⚠️ **Important Note**: This module is not thread-safe. The caching mechanism uses a simple dictionary that is not protected against concurrent access. If you need thread-safety, consider implementing your own synchronization mechanism or disabling caching with `use_cache=False`.\n\n### Key Features\n\n- Simple, intuitive API for accessing AWS Secrets Manager\n- Built-in caching mechanism to minimize API calls\n- Lazy loading support for improved performance\n- Configured retry logic and timeouts\n- Type hints for better IDE support\n- Compatible with Python 3.10+ and Django 4.x/5.x\n\n## Installation\n\n```bash\npip install django-simple-secrets\n```\n\nNote: This package requires `boto3`, which must be installed separately:\n\n```bash\npip install boto3\n```\n\n## Configuration\n\nEnsure your AWS credentials are properly configured either through:\n- Environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)\n- AWS credentials file\n- IAM role (when running on AWS infrastructure)\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom django_secrets import get_secret\n\n# Get an entire secret\ndatabase_config = get_secret('prod/database')\n\n# Get a specific key from a secret\ndatabase_password = get_secret('prod/database', key='password')\n```\n\n### Lazy Loading\n\n```python\nfrom django_secrets import get_secret_lazy\n\n# Secret won't be fetched until actually accessed\ndatabase_config = get_secret_lazy('prod/database')\n```\n\n### Cache Management\n\n```python\nfrom django_secrets import clear_cache\n\n# Clear a specific secret from cache\nclear_cache('prod/database')\n\n# Clear entire cache\nclear_cache()\n\n# Bypass cache for a single request\nfresh_secret = get_secret('prod/database', use_cache=False)\n```\n\n## Error Handling\n\nThe module raises standard boto3 exceptions:\n\n```python\ntry:\n    secret = get_secret('prod/database')\nexcept ClientError as e:\n    # Handle AWS-specific errors\n    pass\nexcept KeyError as e:\n    # Handle missing key errors\n    pass\n```\n\n## Performance Considerations\n\n- The module maintains a single boto3 client instance\n- Caching is enabled by default to minimize API calls\n- Timeout settings: 2 seconds for both connect and read\n- Maximum retry attempts: 3\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrei-demidov%2Fdjango-simple-secrets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrei-demidov%2Fdjango-simple-secrets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrei-demidov%2Fdjango-simple-secrets/lists"}