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.1.tar.gz
(16.2 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.1-py3-none-any.whl
(17.1 kB
view details)
File details
Details for the file xboto-1.2.1.tar.gz.
File metadata
- Download URL: xboto-1.2.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8498829c276ea36699d3e6c8f7c8fc3ef9e95084f605a203281c1ea7c60cf676
|
|
| MD5 |
12de2c954b258c5333682daf0aec637e
|
|
| BLAKE2b-256 |
4449c56bab2af6e1f29a9d4b7607c34d56c0115a767c071367c1fc1c86a18e06
|
File details
Details for the file xboto-1.2.1-py3-none-any.whl.
File metadata
- Download URL: xboto-1.2.1-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.12.3 Linux/6.14.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed707c712cd1165a5e1eefbae53bd50754f5a9b6ce6ab74e27d59afd0b3433c2
|
|
| MD5 |
fc725ae0d2cde32fa284d88a883d5ac7
|
|
| BLAKE2b-256 |
f7d1f3ed0c1f9092f0ff244f3ed0bf3701cc4646273676ea2f6c3d197e513f2c
|