Bolt Python SDK
Project description
Bolt SDK
This SDK provides an authentication solution for programatically interacting with Bolt. It wraps the boto3 interface so project wide integration is as easy as refactoring import boto3
to import bolt as boto3
.
The package affects the signing and routing protocol of the boto3 S3 client, therefore any non S3 clients created through this SDK will be un-affected by the wrapper.
Prerequisites
The minimum supported version of Python is version 2.
Installation
python -m pip install bolt-sdk-py2
Configuration
For the client to work it must have knowledge of Bolt's service discovery url (BOLT_URL
)
These are parameterized by the region of Bolt's deployment. A preferred availability zone ID can also be provided for AZ-aware routing.
Expose Bolt's URL to the SDK:
- Declare the ENV variable:
BOLT_CUSTOM_DOMAIN
, which constructs Bolt URL and hostname based on default naming
export BOLT_CUSTOM_DOMAIN="example.com"
There are two ways to expose Bolt's region/preferred availability zone to the SDK:
If running on an EC2 instance, the SDK will use the instance's region and availability zone id, unless overriden with environment variables: BOLT_REGION
and BOLT_AZ_ID
export BOLT_REGION='<region>'
export BOLT_AZ_ID='<az-id>'
Example usage
import bolt
# Create an S3 client
s3_client = bolt.client("s3")
# Define a function that performs the put_object operation
s3_client.put_object(Body="data", Bucket="BUCKET_NAME", Key="key")
obj = s3_client.get_object(Bucket="BUCKET_NAME", Key="key")
body = obj["Body"].read()
Debugging
Import the default logger and set its level to DEBUG
logging.getLogger().setLevel(logging.DEBUG)
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
Built Distribution
Hashes for bolt_sdk_py2-1.0.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f67ff2717c4eec7d3dd72d36048a40357ceb2292c99f5d64a465251ca46aaeeb |
|
MD5 | b2c72fddf3a848ff0100be0c8a5d8d55 |
|
BLAKE2b-256 | d0a3456acf30139209607c201a42d3ee446b290387ee63e6bb8983a79ec1b973 |