Easy lazy dependency injection for boto3 clients/resources.
Project description
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
xboto-1.2.2-py3-none-any.whl
(17.3 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb417a07c116f2633cbf85882b4cf894cee4210c3c5badbfda84cb59e626a102
|
|
| MD5 |
d04c610477de2900b74f7357ab9322d0
|
|
| BLAKE2b-256 |
de5043fcb3976ec9ebfcaff8e60549acbbc46bc7b6f72e3fd4a7d3106b561dc7
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3094d6899e563a500b9208b6c20d1585e35021edd5bfd476c9a5b079d6dd31e
|
|
| MD5 |
c1f2952f11fc5800d6682a35969ce53d
|
|
| BLAKE2b-256 |
741256d72b92e3c134c011926a9fdd3c8ec2826e282deb095d8960d42b8d0c65
|