Skip to main content

Easy lazy dependency injection for boto3 clients/resources.

Project description

PythonSupport PyPI version

Documentation

📄 Detailed Documentation | 🐍 PyPi

Install

# via pip
pip install xboto

# via poetry
poetry add xboto

Quick Start

Import Boto Client/Resource

# Use imported `dynamodb` just like dynamodb boto resource
from xboto.resource import dynamodb

# Use imported `ssm` just like ssm boto client
from xboto.client import ssm

# These are for overriding/injecting settings.
from xboto import BotoResources, BotoClients, BotoSession

# Can use them like normal:
dynamodb.table(...)
ssm.get_object(...)


# Or you can override settings if you wish:
with BotoResources.DynamoDB(region_name='us-west-2'):
    # Use us-west-2 when using dynamodb boto resource:
    dynamodb.table(...)

with BotoClients.Ssm(region_name='us-west-2'):
    # Use us-west-2 when using ssm boto client:
    ssm.get_object(...)

with BotoSession(region_name='us-west-3'):
    # Use us-west-3 when using any client/resource
    # we are setting it at the boto-session level;
    # the session is used by all boto client/resources.
    ssm.get_object(...)

    
# Can use them like decorators as well:
@BotoClients.Ssm(region_name='us-west-2')
def some_method():
    ssm.get_object(...)

Grab Any Client/Resource

# Can easily ask these for any client/resource
from xboto import boto_clients, boto_resources

# These are for overriding/injecting settings.
from xboto import BotoResources, BotoClients, BotoSession

# Can use them like normal:
boto_clients.dynamodb.table(...)
boto_resources.ssm.get_object(...)


# Or you can override settings if you wish:
with BotoResources.DynamoDB(region_name='us-west-2'):
    # Use us-west-2 when using dynamodb boto resource:
    boto_resources.dynamodb.table(...)

with BotoClients.Ssm(region_name='us-west-2'):
    # Use us-west-2 when using ssm boto client:
    boto_clients.ssm.get_object(...)

with BotoSession(region_name='us-west-3'):
    # Use us-west-3 when using any client/resource
    # we are setting it at the boto-session level;
    # the session is used by all boto client/resources.
    boto_clients.ssm.get_object(...)

    
# Can use them like decorators as well:
@BotoClients.Ssm(region_name='us-west-2')
def some_method():
    boto_clients.ssm.get_object(...)

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

xboto-1.2.2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

xboto-1.2.2-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file xboto-1.2.2.tar.gz.

File metadata

  • Download URL: xboto-1.2.2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.3 Linux/6.17.0-1013-azure

File hashes

Hashes for xboto-1.2.2.tar.gz
Algorithm Hash digest
SHA256 bb417a07c116f2633cbf85882b4cf894cee4210c3c5badbfda84cb59e626a102
MD5 d04c610477de2900b74f7357ab9322d0
BLAKE2b-256 de5043fcb3976ec9ebfcaff8e60549acbbc46bc7b6f72e3fd4a7d3106b561dc7

See more details on using hashes here.

File details

Details for the file xboto-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: xboto-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.3 Linux/6.17.0-1013-azure

File hashes

Hashes for xboto-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3094d6899e563a500b9208b6c20d1585e35021edd5bfd476c9a5b079d6dd31e
MD5 c1f2952f11fc5800d6682a35969ce53d
BLAKE2b-256 741256d72b92e3c134c011926a9fdd3c8ec2826e282deb095d8960d42b8d0c65

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