Skip to main content

Позволяет шифровать и хранить файлы в облачном хранилище

Используется потоковое шифрование

Доступные хранилища:

  • Yandex.Disk (sync/async)
  • AWS S3 (sync/async)

Установка

Поддержка только яндекс диска

pip install encrypt-storage

С поддержкой AWS S3

pip install encrypt-storage[aws]

Пример

Синхронное использование

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)

Асинхронное использование

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())

Metadata

Release files for encrypt-storage 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for encrypt-storage 0.2.3
File Size Uploaded
encrypt_storage-0.2.3.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for encrypt-storage 0.2.3
File Interpreter ABI Platform
encrypt_storage-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / encrypt_storage-0.2.3.tar.gz

Download URL encrypt_storage-0.2.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
951192f34327650fcf600a1e30040a8dcf9586899ba7f4bb2685498bdf0ef0c8
BLAKE2b-256 checksum
How to use checksums
9c5afc26c847807b01751262a94cfbcccf179dfc4ee4901e17affff0245a4382
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.2 Windows/10

Release files / encrypt_storage-0.2.3-py3-none-any.whl

Download URL encrypt_storage-0.2.3-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e20c2370cc94eca833c17909aa0788833bfd61deb414bc78b9fc5f8bcb960ae
BLAKE2b-256 checksum
How to use checksums
ae8d933f96fb3f0863d9a70ccd302e4b90e7b1d4094db75b85050153525f08f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.2 Windows/10

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page