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
Metadata
Release files for claws 0.0.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| claws-0.0.22.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| claws-0.0.22-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / claws-0.0.22.tar.gz
| Download URL | claws-0.0.22.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d8088a2143f914405fdeab8b77c953f039d3f565bb4827b5371b5404b3cf520
|
|
BLAKE2b-256 checksum How to use checksums |
68538e2d7b7c7aa0ef3625af591406e2503486ffcebf8b401be3cf74372e83cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / claws-0.0.22-py3-none-any.whl
| Download URL | claws-0.0.22-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f594a44fedd076737838e34169eeeb5370598f8e7059fc34efad3c0ab0ebb223
|
|
BLAKE2b-256 checksum How to use checksums |
5daa62364e70b5c3874e857189840f90378ddfc3add5b14f1b3707d1655f7d52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|