Skip to main content

Lightweight S3 client with backblaze support

Project description

from ctypes import pythonapi

        ___       __    __                _       __    __         _____
       / (_)___ _/ /_  / /__      _____  (_)___ _/ /_  / /_   ____|__  /
      / / / __ `/ __ \/ __/ | /| / / _ \/ / __ `/ __ \/ __/  / ___//_ < 
     / / / /_/ / / / / /_ | |/ |/ /  __/ / /_/ / / / / /_   (__  )__/ / 
    /_/_/\__, /_/ /_/\__/ |__/|__/\___/_/\__, /_/ /_/\__/  /____/____/  
        /____/                          /____/                          

lightweight-s3

Ultra-lightweight S3 client. Memory leakage not implemented yet (unlike boto3)

Supports:

  • sending existing files
  • sending string as zipped json (data sinks)
  • Operates within a session refreshed every four hours; be sure to shut down the client when you’re done.
Usage Create StorageConnectionParameters:
from lightweight_s3 import StorageConnectionParameters

storage_connection_parameters = StorageConnectionParameters(
    backblaze_access_key_id='access_key_id',
    backblaze_secret_access_key='secret_access_key',
    backblaze_endpoint_url='endpoint_url',
    backblaze_bucket_name='bucket_name'
)

Or just put em into the .env file. Load the .env using load_dotenv()
StorageConnectionParameters() will read all of parameters in format:

BACKBLAZE_ACCESS_KEY_ID=  
BACKBLAZE_SECRET_ACCESS_KEY=  
BACKBLAZE_ENDPOINT_URL=  
BACKBLAZE_BUCKET_NAME=  

or

AZURE_BLOB_PARAMETERS_WITH_KEY=  
AZURE_CONTAINER_NAME=

then:

load_dotenv(env_path)
storage_connection_parameters = StorageConnectionParameters()
s3_client = S3Client(storage_connection_parameters)

s3_client.upload_existing_file(file_path='C:/JohnnySins/Documents/SomeFile.csv')

s3_client.upload_zipped_jsoned_string(
    data='{some_sophisticated_data....}',
    file_name='some_csv_name.csv'
)

s3_client.shutdown()
Sample Main And the final sample main.py would look like:
from lightweight_s3 import S3Client, StorageConnectionParameters


if __name__ == '__main__ ':

    storage_connection_parameters = StorageConnectionParameters(
        backblaze_access_key_id='access_key_id',
        backblaze_secret_access_key='secret_access_key',
        backblaze_endpoint_url='endpoint_url',
        backblaze_bucket_name='bucket_name'
    )

    """
    Or just put em into the .env file. Load the .env using:
    
            load_dotenv(env_path)
    
    and then read it using:
    
            storage_connection_parameters = StorageConnectionParameters()
    """

    s3_client = S3Client(storage_connection_parameters)

    s3_client.upload_existing_file(file_path='C:/JohnnySins/Documents/SomeFile.csv')

    s3_client.upload_zipped_jsoned_string(
        data='some_sophisticated_data....',
        file_name='some_csv_name.csv'
    )

    s3_client.shutdown()

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

lightweight_s3-0.0.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

lightweight_s3-0.0.2-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file lightweight_s3-0.0.2.tar.gz.

File metadata

  • Download URL: lightweight_s3-0.0.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for lightweight_s3-0.0.2.tar.gz
Algorithm Hash digest
SHA256 16d0baad8e98f427000f46964d61d8ace4e5dc04741fdadc734ce90129dfb5bc
MD5 124e8bc689fbbb1b765be1f640f446bf
BLAKE2b-256 5c6968a2c8fb31cd73fc3e1f2584fb036c8b3850817c32213098b30836bce30c

See more details on using hashes here.

File details

Details for the file lightweight_s3-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: lightweight_s3-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for lightweight_s3-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a6a0f0242e18343c1778f3a1ab819a94e914ffe65f1b6bb043c9d0a1c643b52
MD5 44f286ca713135ad3b0c04b7db056726
BLAKE2b-256 4e605ca45fbda750f18322a0354011bf111377f481263a5e52416063517bf790

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