### Позволяет шифровать и хранить файлы в облачном хранилище
Используется потоковое шифрование
Доступные хранилища:
- Yandex.Disk (sync/async)
- AWS S3 (sync/async)
### Установка
Поддержка только яндекс диска
```shell
pip install encrypt-storage
```
С поддержкой AWS S3
```shell
pip install encrypt-storage[aws]
```
### Пример
Синхронное использование
```python
from encrypt_storage import YandexDiskStorage
# Замените 'YOUR_ACCESS_TOKEN' на ваш токен Яндекс.Диска
# Замените 'YOUR_ENCRYPTION_KEY' на ваш ключ шифрования
yandex_disk = YandexDiskStorage(
"YOUR_ACCESS_TOKEN",
"YOUR_ENCRYPTION_KEY",
)
# Пример загрузки и шифрования файла
local_file = "docker-compose.yaml"
remote_path = "docker-compose.yaml"
yandex_disk.upload_and_encrypt_file(local_file, remote_path)
# Пример дешифрования файла
decrypted_local_file = "docker-compose2.yaml"
yandex_disk.download_and_decrypt_file(remote_path, decrypted_local_file)
# Пример получения данных файлов
files = yandex_disk.list_files("/")
print(files)
```
Асинхронное использование
```python
import asyncio
from encrypt_storage.asyncio import YandexDiskStorage
async def main():
# Замените 'YOUR_ACCESS_TOKEN' на ваш токен Яндекс.Диска
# Замените 'YOUR_ENCRYPTION_KEY' на ваш ключ шифрования
yandex_disk = YandexDiskStorage(
"YOUR_ACCESS_TOKEN",
"YOUR_ENCRYPTION_KEY",
)
# Пример загрузки и шифрования файла
local_file = "docker-compose.yaml"
remote_path = "docker-compose.yaml"
await yandex_disk.upload_and_encrypt_file(local_file, remote_path)
# Пример дешифрования файла
decrypted_local_file = "docker-compose2.yaml"
await yandex_disk.download_and_decrypt_file(remote_path, decrypted_local_file)
# Пример получения метаданных файлов
files = await yandex_disk.list_files("/")
print(files)
if __name__ == "__main__":
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ig-rudenko/encrypt-storage",
"name": "encrypt-storage",
"maintainer": "",
"docs_url": null,
"requires_python": ">3.9",
"maintainer_email": "",
"keywords": "remote-storage,encryption,yandex-disk,aws-s3,encryption-decryption",
"author": "ig-rudenko",
"author_email": "ig.rudenko1@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/9c/5a/fc26c847807b01751262a94cfbcccf179dfc4ee4901e17affff0245a4382/encrypt_storage-0.2.3.tar.gz",
"platform": null,
"description": "### \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\n\n\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u043e\u0435 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\n\n\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430:\n\n- Yandex.Disk (sync/async)\n- AWS S3 (sync/async)\n\n### \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\n\n\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u044f\u043d\u0434\u0435\u043a\u0441 \u0434\u0438\u0441\u043a\u0430\n\n```shell\npip install encrypt-storage\n```\n\n\u0421 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 AWS S3\n\n```shell\npip install encrypt-storage[aws]\n```\n\n### \u041f\u0440\u0438\u043c\u0435\u0440\n\n\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\n\n```python\nfrom encrypt_storage import YandexDiskStorage\n\n# \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 'YOUR_ACCESS_TOKEN' \u043d\u0430 \u0432\u0430\u0448 \u0442\u043e\u043a\u0435\u043d \u042f\u043d\u0434\u0435\u043a\u0441.\u0414\u0438\u0441\u043a\u0430\n# \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 'YOUR_ENCRYPTION_KEY' \u043d\u0430 \u0432\u0430\u0448 \u043a\u043b\u044e\u0447 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f\nyandex_disk = YandexDiskStorage(\n \"YOUR_ACCESS_TOKEN\",\n \"YOUR_ENCRYPTION_KEY\",\n)\n\n# \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430\nlocal_file = \"docker-compose.yaml\"\nremote_path = \"docker-compose.yaml\"\nyandex_disk.upload_and_encrypt_file(local_file, remote_path)\n\n# \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430\ndecrypted_local_file = \"docker-compose2.yaml\"\nyandex_disk.download_and_decrypt_file(remote_path, decrypted_local_file)\n\n# \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\nfiles = yandex_disk.list_files(\"/\")\nprint(files)\n```\n\n\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\n\n```python\nimport asyncio\n\nfrom encrypt_storage.asyncio import YandexDiskStorage\n\n\nasync def main():\n # \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 'YOUR_ACCESS_TOKEN' \u043d\u0430 \u0432\u0430\u0448 \u0442\u043e\u043a\u0435\u043d \u042f\u043d\u0434\u0435\u043a\u0441.\u0414\u0438\u0441\u043a\u0430\n # \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 'YOUR_ENCRYPTION_KEY' \u043d\u0430 \u0432\u0430\u0448 \u043a\u043b\u044e\u0447 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f\n yandex_disk = YandexDiskStorage(\n \"YOUR_ACCESS_TOKEN\",\n \"YOUR_ENCRYPTION_KEY\",\n )\n\n # \u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430\n local_file = \"docker-compose.yaml\"\n remote_path = \"docker-compose.yaml\"\n await yandex_disk.upload_and_encrypt_file(local_file, remote_path)\n\n # \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430\n decrypted_local_file = \"docker-compose2.yaml\"\n await yandex_disk.download_and_decrypt_file(remote_path, decrypted_local_file)\n\n # \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\n files = await yandex_disk.list_files(\"/\")\n print(files)\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n\n```",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u042f\u043d\u0434\u0435\u043a\u0441 \u0434\u0438\u0441\u043a \u043a\u0430\u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c",
"version": "0.2.3",
"project_urls": {
"Homepage": "https://github.com/ig-rudenko/encrypt-storage",
"Repository": "https://github.com/ig-rudenko/encrypt-storage"
},
"split_keywords": [
"remote-storage",
"encryption",
"yandex-disk",
"aws-s3",
"encryption-decryption"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ae8d933f96fb3f0863d9a70ccd302e4b90e7b1d4094db75b85050153525f08f8",
"md5": "ad87a525976bf1a1eb87b5a680bb5d43",
"sha256": "2e20c2370cc94eca833c17909aa0788833bfd61deb414bc78b9fc5f8bcb960ae"
},
"downloads": -1,
"filename": "encrypt_storage-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ad87a525976bf1a1eb87b5a680bb5d43",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">3.9",
"size": 9738,
"upload_time": "2023-11-10T23:45:16",
"upload_time_iso_8601": "2023-11-10T23:45:16.306844Z",
"url": "https://files.pythonhosted.org/packages/ae/8d/933f96fb3f0863d9a70ccd302e4b90e7b1d4094db75b85050153525f08f8/encrypt_storage-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9c5afc26c847807b01751262a94cfbcccf179dfc4ee4901e17affff0245a4382",
"md5": "95cb43c8992cacc27a07544b29561bf0",
"sha256": "951192f34327650fcf600a1e30040a8dcf9586899ba7f4bb2685498bdf0ef0c8"
},
"downloads": -1,
"filename": "encrypt_storage-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "95cb43c8992cacc27a07544b29561bf0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">3.9",
"size": 5660,
"upload_time": "2023-11-10T23:45:17",
"upload_time_iso_8601": "2023-11-10T23:45:17.468029Z",
"url": "https://files.pythonhosted.org/packages/9c/5a/fc26c847807b01751262a94cfbcccf179dfc4ee4901e17affff0245a4382/encrypt_storage-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-10 23:45:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ig-rudenko",
"github_project": "encrypt-storage",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "encrypt-storage"
}