Skip to main content

Helpers to make using boto3 more enjoyable

Project description

What is this?

This is a util package to help making boto3 more enjoyable.

Below is a list of the use cases:

client

instead of doing:

import boto3

client = boto3.client('cloudformation')

You can do

import betterboto

with betterboto.ClientContextManager('cloudformation') as client:
    client.create_stack

Instead of doing:

import boto3 

role_arn = 'arn:aws:iam::123456789010:role/super-role'
role_session_name = 'super-role'

sts = boto3.client('sts')
assumed_role_object = sts.assume_role(
    RoleArn=role_arn,
    RoleSessionName=role_session_name,
)
credentials = assumed_role_object['Credentials']
kwargs = {
    "aws_access_key_id": credentials['AccessKeyId'],
    "aws_secret_access_key": credentials['SecretAccessKey'],
    "aws_session_token": credentials['SessionToken'],
}
client = boto3.client(
    'cloudformation',
    aws_access_key_id=credentials['AccessKeyId'],
    aws_secret_access_key=credentials['SecretAccessKey'],
    aws_session_token=credentials['SessionToken'],
)

You can do

import betterboto

with betterboto.CrossAccountClientContextManager('cloudformation', 'arn:aws:iam::123456789010:role/super-role', 'super-role') as client:
    client.create_stack

cloudformation

instead of

Project details


Release history Release notifications | RSS feed

This version

0.0.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better-boto-0.0.3.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file better-boto-0.0.3.tar.gz.

File metadata

  • Download URL: better-boto-0.0.3.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for better-boto-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a93ed49488caa87be8d96765e27e448022872f3052b9276c6a09e2e9bf7ab089
MD5 a1c06967567e2541901205567f5c009c
BLAKE2b-256 cc24cb1540f67247f681cf299d7fcd7d68d86526d4862066c09ed87cfd62cb49

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