Granica SDK
This SDK provides an authentication solution for programatically interacting with Granica. It wraps the boto3 interface so project wide integration is as easy as refactoring import boto3 to import granica 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 3.
Installation
python3 -m pip install granica-sdk
Usage
In order to use this package, you need to set the following environment variables where your application will be running
export GRANICA_CUSTOM_DOMAIN=<YOUR_CUSTOM_DOMAIN>
export GRANICA_REGION=<YOUR_GRANICA_CLUSTER_REGION>
# Optional if not running on an ec2 instance to force read from a read-replica in this az
export GRANICA_AZ_ID=<AZ_ID>
For backwards compatibility, the following environment variables are supported
BOLT_CUSTOM_DOMAIN --> GRANICA_CUSTOM_DOMAIN
BOLT_REGION --> GRANICA_REGION
BOLT_AZ_ID --> GRANICA_AZ_ID
If the region and AZ environment variables aren't specified when running on an EC2 instance, the SDK will use the ec2 metadata api to fetch the instance's region and availability zone id.
Example S3 GetObject
import granica as boto3
s3_client = boto3.client('s3')
s3_client.put_object(Body="data", Bucket="BUCKET_NAME", Key="key")
response = s3_client.get_object(Bucket="BUCKET_NAME", Key="key")
obj = response['Body'].read()
Debugging
Import the default logger and set its level to DEBUG
logging.getLogger().setLevel(logging.DEBUG)
Tests
Basic integration tests are provided for the modified Session/Client interfaces. They must be run in an environment with a properly configured Granica deployment accessible.
python3 tests/tests.py
Metadata
Release files for granica-sdk 2.2.0
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 |
|---|---|---|---|---|
| granica-sdk-2.2.0.tar.gz | 12.0 kB | Without provenance | Details for granica-sdk-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| granica_sdk-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for granica_sdk-2.2.0-py3-none-any.whl |
Total release size: 24.5 kB
Release files / granica-sdk-2.2.0.tar.gz
| Download URL | granica-sdk-2.2.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5faf0bab5f788795b0696a63f271dbc33cd72a6e447e71915a7fb937d9793a9
|
|
BLAKE2b-256 checksum How to use checksums |
6286e8aa98d268781412b79991f41ab56dd8048fae6c2e02d00ff5a35daaad8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / granica_sdk-2.2.0-py3-none-any.whl
| Download URL | granica_sdk-2.2.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9df185ac39708ff9c8fa5582add72df38329aa04b988e9af124fb5b2164da03
|
|
BLAKE2b-256 checksum How to use checksums |
62062234ae0bc9bf42c6d932c8832c09368950bd8ace99c21a47cbde30a40794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for granica-sdk 2.2.0
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.