AWS S3 tools package
Project description
AWS S3 Tools
AWS S3 Tools is a Python package to make it easier to interact with S3 objects, where you can:
- List S3 bucket content
- Check if an S3 object exists
- Download/upload S3 objects to/from local files
- Read/write S3 objects into/from Python variables
- Delete/move/copy S3 objects
The AWS S3 authentication is done via boto3 package, via environment variables, aws config file, or parameters.
All S3 objects functions, in this package, have the option to set AWS Session authentication by passing the following dictionary on the aws_auth
parameter, with the schema below (not all field are required).
To understand more about AWS authentication mechanism, read boto3 documentation.
aws_auth = {
'region_name': 'REGION',
'aws_access_key_id': 'ACCESS_KEY',
'aws_secret_access_key': 'SECRET_KEY',
'aws_session_token': 'SESSION_TOKEN',
'profile_name': 'PROFILE_NAME'
}
Installation
You can install AWS S3 Tools from PyPi with pip
or your favorite package manager:
pip install aws-s3-tools
Add the -U
switch to update to the current version, if AWS S3 Tools is already installed.
If you want to use the progress bar feature when downloading or uploading, you need to install an extra dependency.
pip install aws-s3-tools[progress]
Usage
The full documentation can be found here.
from s3_tools import object_exists
if object_exists("my-bucket", "s3-prefix/object.data"):
# Your code goes here
else:
print("Object not found")
Example to use the progress bar:
from s3_tools import upload_folder_to_prefix
result = upload_folder_to_prefix(
bucket='dlite-tools',
prefix='aws-s3-tools',
search_str='*.py',
threads=2,
folder='s3_tools',
show_progress=True
)
Progress bar when running the code above:
Contributions
All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome.
A detailed overview on how to contribute can be found in the contributing guide on GitHub.
Issues
Go here to submit feature requests or bugfixes.
License and Credits
AWS S3 Tools
is licensed under the MIT license and is written and
maintained by:
- Daniel Ferrari (@FerrariDG)
- Carlos Alves (@cmalves)
- Tomás Osório (@tomassosorio)
Acknowledgement
The idea from these functions come from an amazing team that I worked with. This repo is a refactor and documentation to make this public to everyone.
Many thanks to:
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 aws_s3_tools-0.3.0.tar.gz
.
File metadata
- Download URL: aws_s3_tools-0.3.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.16 Linux/5.15.0-1038-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8ec8f1505e3373df863c1f2a587e76161c0b7b789c920bd66ed582570f3e2bd |
|
MD5 | 2841104d6bd213a56d909482741ea77c |
|
BLAKE2b-256 | 79652cd30bf9141721af0458ac7e61ce36a14627f80b9378f00d5f377bd3c338 |
File details
Details for the file aws_s3_tools-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: aws_s3_tools-0.3.0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.16 Linux/5.15.0-1038-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e77ddf08e258e2acabfbbfe47b017ba69e76e91c60788edf47d269c725418872 |
|
MD5 | f8481ddb93f3f5e2c7b72456de8463b1 |
|
BLAKE2b-256 | 3bd761117bece8b45f2e11474c4b11f869948a89be22c72a70eaa2589da4a3e2 |