The Crossref Labs AWS tooling system.
Project description
Claws: Crossref Labs AWS Tools
Claws is a Python module that provides a simple and convenient way to interact with AWS services, such as S3 and CloudWatch. It utilizes the boto3 library and aiohttp for asynchronous operations, making it ideal for applications that require high-performance and efficient resource utilization.
This is a prototype Crossref Labs system. It is not guaranteed to be stable and the metadata schema and behaviour may be subject to change at any time.
Features
- S3 client and resource management with automatic deferred initialization
- Presigned URL generation for S3 objects
- Asynchronous downloading of multiple S3 objects
- Retrieval of S3 objects as strings
- Custom exception handling for S3 object retrieval errors
- Easy integration with monitoring and instrumentation tools
- Streaming upload to S3 to handle large JSON files
Requirements
- Python 3.6 or higher
- boto3
- aiohttp
- smart-open
Installation
To install the Claws module, simply use the following pip command:
pip install claws
Usage
Here is a basic example of how to use the Claws module to interact with AWS S3:
from claws.aws_utils import AWSConnector
# Initialize the AWSConnector with a specific S3 bucket
connector = AWSConnector(bucket="my-bucket", unsigned=False)
# Download an S3 object as a string
result = connector.s3_obj_to_str(bucket="my-bucket", s3_path="path/to/object.txt")
# Download multiple S3 objects asynchronously in parallel
s3_objects = ["path/to/object1.txt", "path/to/object2.txt", "path/to/object3.txt"]
results = connector.get_multiple_s3_objs(bucket="my-bucket", s3_objs=s3_objects)
for result in results:
print(result)
Contributing
Contributions to the Claws module are welcome. Please feel free to submit pull requests or report issues on the GitHub repository.
License
Claws is released under the MIT License.
Credits
- .gitignore from Github.
- AWS Lambda Powertools by Amazon.
© Crossref 2023
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
File details
Details for the file claws-0.0.21.tar.gz
.
File metadata
- Download URL: claws-0.0.21.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c82cf0b093f72c729c7c27e39625423525a7b6e532c59e44f8784938609ce08 |
|
MD5 | 584f3134859caaf267fde477e38392ab |
|
BLAKE2b-256 | e9706d1ff0b9db513b3fd6ee0d7ba62a910fc244cf07563fe7c95130c55c4abc |
File details
Details for the file claws-0.0.21-py3-none-any.whl
.
File metadata
- Download URL: claws-0.0.21-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ec3c9a11f9c2597445c83a652c5db768c5da7192adb5b64931ebaf533080ce0 |
|
MD5 | 808a0c695e9cd439d93bef1edc99799a |
|
BLAKE2b-256 | 29d49cbc2c2bc0ed1b4964997d9769ffdc659ead369251d4799e2631731eb01a |