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 four are responsible for setting up the default connection, you need to specify everything except the region to enable it.

Bucket is used by default unless another one is programmatically selected.

Variables are extracted from the environment:

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

These variables can be overridden:

from s3.settings import settings

settings.AWS_BUCKET = "some_bucket"

!! Attention !! After creating a default connection, changing the settings variables for it is ignored.

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 the aiofiles binary file descriptor
from s3 import s3, async_s3

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

# Asynchronous
client = 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-1.3.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

connectkit_s3-1.3.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: connectkit_s3-1.3.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.14.0 CPython/3.9.13 Windows/10

File hashes

Hashes for connectkit_s3-1.3.1.tar.gz
Algorithm Hash digest
SHA256 190f021b52bd7059fc1e3ad64432f2e2ad2ee00ddb6de5bc8ef5d96e0021e5fb
MD5 34a2b678e0efd7324b3a959add5c4225
BLAKE2b-256 382b83d2197fdbec81038d109083c2382a214795a83d13026cda762fc47c7ee1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: connectkit_s3-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.14.0 CPython/3.9.13 Windows/10

File hashes

Hashes for connectkit_s3-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5437cdbe68576edfd0d31c540fced5cebd53936e9ba8396420f2171beb090e22
MD5 cca1b7acd9194033ac5814df4746d6f4
BLAKE2b-256 eb4980f4c726225206e3e52afcffbeffac939fb5dbdac1cb461cf227f85f375c

See more details on using hashes here.

Supported by

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