Skip to main content

Wrapper for connection to S3

Project description

ConnectKit S3 [en|ru]


ConnectKit S3 is a wrapper for boto3 and aioboto3 to simplify working with S3 storages.

Includes pydantic settings, template code.

Installation


To install the sync version:

pip install ConnectKit-S3

To install the async version:

pip install ConnectKit-S3[async]

Usage


These variables from settings are used for connection by default. All variables are optional.

The first three are responsible for setting up the default connection, you need to specify everything to enable it.

Bucket and region are used by default unless another one is specified in connection.

Variables are extracted from the environment or .env file:

AWS_HOST=str               # Address of S3 server
AWS_ACCESS_KEY_ID=str      # Access key
AWS_SECRET_ACCESS_KEY=str  # Secret key
AWS_REGION=str             # Region, optional
AWS_BUCKET=str             # Default bucket

The s3 and async_s3 functions are used to open the connection.

Uploading and downloading files requires:

  • Synchronous mode requires a synchronous file descriptor open in binary mode.
  • Asynchronous mode requires a synchronous or aiofiles binary file descriptor
from s3 import s3
from s3.asyncio import async_s3

# Synchronous
client = s3()
if client.has_file("s3_filename"):
    pass

# Asynchronous
client = await async_s3()

async with client() as conn:
    if conn.has_file("s3_filename"):
        pass

License


ConnectKit S3 is MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

connectkit_s3-3.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

connectkit_s3-3.0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file connectkit_s3-3.0.1.tar.gz.

File metadata

  • Download URL: connectkit_s3-3.0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.21.0 CPython/3.10.11 Windows/10

File hashes

Hashes for connectkit_s3-3.0.1.tar.gz
Algorithm Hash digest
SHA256 10651bda3d7e5fdf344ecad2a1ddf909f24609f1bf3f1aad793cbf35e6c10d1f
MD5 edd215ebaa0468bcd7c42c609c17d1f4
BLAKE2b-256 83f724df674f9d8fea06ba1450a4063a7756ae0345d1fd6ac47479278102274f

See more details on using hashes here.

File details

Details for the file connectkit_s3-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: connectkit_s3-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.21.0 CPython/3.10.11 Windows/10

File hashes

Hashes for connectkit_s3-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eddef0669f56702b7283228fff2dc313cffaf4179b27c2be5c31927e5a7ed654
MD5 c8ae356c383fee2023497e1d3ce293d5
BLAKE2b-256 8256fd56adbff22014c4eaa0f75d972c290f5d24df31595ca378dea096b50c38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page