PyAwsHelper
Python AWS Helper Library
AWS Region Helper
Get Boto3 Client and Resource with refreshable session
from PyAwsHelper.boto_helper import BotoHelper
helper = BotoHelper()
# Both client is sharing common refreshable session
s3_client = helper.get_client(service_name="s3", region_name="us-east-1", role_arn="arn:aws:iam::123:role/my_db_role")
db_client = helper.get_client(service_name="dynamodb", region_name="us-east-1", role_arn="arn:aws:iam::123:role/my_db_role")
Use Raw Refreshable session to implement your need
# can use BotoHelper to get session
from PyAwsHelper.boto_helper import BotoHelper
helper = BotoHelper()
s3_client = helper.get_session(region_name="us-east-1", role_arn="arn:aws:iam::123:role/my_db_role")
# or can directly access raw BotoSession module
from PyAwsHelper.boto_session import BotoSession
session = BotoSession().refreshable_session()
client = session.client("s3") # we now can cache this client object without worrying about expiring credentials
Get AWS region from region suffix
from PyAwsHelper.region import Region
aws_region = Region.get_region("va")
>>> aws_region
'us-east-1'
Also supports providing default value
from PyAwsHelper.region import Region
aws_region = Region.get_region("foo", default_region="bar")
>>> aws_region
'bar'
Get region suffix from AWS region
from PyAwsHelper.region import Region
aws_region = Region.get_region_suffix("us-east-1")
>>> aws_region
'va'
Also supports providing default value
from PyAwsHelper.region import Region
aws_region = Region.get_region_suffix("foo", default_region_suffix="bar")
>>> aws_region
'bar'
Regions Config
{
"hk": "ap-east-1", # Hong Kong
"tk": "ap-northeast-1", # Tokyo
"se": "ap-northeast-2", # Seoul
"os": "ap-northeast-3", # Osaka-Local
"mu": "ap-south-1", # Mumbai
"sg": "ap-southeast-1", # Singapore
"sy": "ap-southeast-2", # Sydney
"au": "ap-southeast-2", # Sydney
"ce": "ca-central-1", # Central
"be": "cn-north-1", # Beijing
"ni": "cn-northwest-1", # Ningxia
"fr": "eu-central-1", # Frankfurt
"st": "eu-north-1", # Stockholm
"ir": "eu-west-1", # Ireland
"lo": "eu-west-2", # London
"pa": "eu-west-3", # Paris
"ba": "me-south-1", # Bahrain
"sp": "sa-east-1", # São Paulo
"va": "us-east-1", # N. Virginia
"va-gov": "us-gov-east-1",
"oh": "us-east-2", # Ohio
"ca": "us-west-1", # N. California
"nc": "us-west-1", # N. California
"ca-gov": "us-gov-west-1",
"nc-gov": "us-gov-west-1",
"or": "us-west-2", # Oregon
}
Metadata
Release files for PyAwsHelper 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyAwsHelper-0.0.10.tar.gz | 5.7 kB | Without provenance | Details for PyAwsHelper-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyAwsHelper-0.0.10-py3-none-any.whl | Python 3 | none | any | Details for PyAwsHelper-0.0.10-py3-none-any.whl |
Total release size: 13.9 kB
Release files / PyAwsHelper-0.0.10.tar.gz
| Download URL | PyAwsHelper-0.0.10.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dfab8bff71d5bc851b9b479aac99e887a96a35a3de85a0f504a5440ca736ed2
|
|
BLAKE2b-256 checksum How to use checksums |
913adbc7a60bac09cfec9f07021c495fcaed1c3da19ba667eeeae39edaeb62a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / PyAwsHelper-0.0.10-py3-none-any.whl
| Download URL | PyAwsHelper-0.0.10-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48e7fa8e1b70e8ab0d27e903244b88b57b364e42bd0c364e46436ec264e8b90e
|
|
BLAKE2b-256 checksum How to use checksums |
bd32e2ad4f9c62acd0f05a3b5de8a6a5070e34a842a306b233440078ef83f7e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for PyAwsHelper 0.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.