Library for interacting with API Gateway and DynamoDB
Project description
API Gateway & DynamoDB Utility Library
Overview
This library provides utility functions to interact with AWS API Gateway and DynamoDB. It enables secure API communication for fetching and upserting data via API Gateway, ensuring robust error handling, logging, and authentication using an API Key.
Features
- ✅ Fetch Data from DynamoDB via API Gateway
- ✅ Upsert Data (Insert/Update) into DynamoDB
- ✅ Secure API Access using API Key
- ✅ Robust Logging & Error Handling
- ✅ Optimized JSON Response Handling
- ✅ Support for Private Repository Deployment
Installation
Prerequisites
Ensure you have Python 3.8+ installed.
Install the required dependencies:
pip install requests
pip install api_gateway_dynamodb
Usage - Read Data
from api_gateway_dynamodb import get_data_from_api_gateway_dynamodb
# API Gateway Endpoint URL
api_url = "https://your-api-gateway-url.com/get-data"
# Example Parameters
database_table_name = "customer"
partition_key = "customer_id"
partition_key_value = "123456"
api_key = "your-api-key-here"
# Fetch data
response = get_data_from_api_gateway_dynamodb(api_url,
database_table_name,
partition_key,
partition_key_value,
api_key)
print(response) # Output: JSON response with data from DynamoDB
Usage - Insert / Update data
from api_gateway_dynamodb import upsert_data_via_api_gateway_dynamodb
# API Gateway Endpoint URL
api_url = "https://your-api-gateway-url.com/upsert-data"
# Example Data Payload
payload = {
"id_number": "123456",
"name": "John",
"surname": "Doe",
"title": "Mr"
}
# Upsert Parameters
method_name = "insert"
table_name = "customer"
partition_key = "id_number"
api_key = "your-api-key-here"
# Insert or Update Data
response = upsert_data_via_api_gateway_dynamodb(payload, method_name, table_name, partition_key, api_key, api_url)
print(response) # Output: JSON response confirming the operation
Project details
Release history Release notifications | RSS feed
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
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
File details
Details for the file api_gateway_dynamodb-0.1.1.tar.gz.
File metadata
- Download URL: api_gateway_dynamodb-0.1.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9115677960cf305e4ffb9b127664b3805d4df3f9c1916caacc7526487ba4aa5
|
|
| MD5 |
8ca05fdc8a7226844bbde44af8ff1877
|
|
| BLAKE2b-256 |
04b5f87d90be04864e504d873856b8effde0bde5dc0e8f863250248021d9fd4f
|
File details
Details for the file api_gateway_dynamodb-0.1.1-py3-none-any.whl.
File metadata
- Download URL: api_gateway_dynamodb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67436df876e587928a1c5ef8d82006e08a94c911afe3a6ddd9899961289506a1
|
|
| MD5 |
e55276f9cfb8d49800e14387d42089c0
|
|
| BLAKE2b-256 |
5d2b012d24feafcd4dccef67fa55c03c3af86afb487471cdbcc6479e4b11d469
|