Library used to download files and support sending to S3
Project description
CathD
Features ✨
- Download Log: The download feature is accompanied by a log for connection speed and remaining time required.
- send to s3: accompanied by a feature to directly send downloaded files to S3 with the s3fs library.
- easy use: Simple calls and easy S3FS configuration.
Requirement ⚙️
Installation 🛠️
pip install cathd
How To Usage 🤔
1. Basic use
If you only want to use the download feature and save it locally on your laptop
from cathd import CathD
url = 'https://raw.githubusercontent.com/ryyos/ryyos/refs/heads/main/images/erine/kawaiii.jpeg'
path = 'data/erine_kawai.jpg'
CathD.download(
url=url,
path=path,
save=True,
)
2. Send to S3 with an external S3FS connection
If you want to send the downloaded file to S3 and you want to use an external S3FS connection, you can enter your S3FS connection into the "s3fs_connection" param.
import s3fs
from cathd import CathD
url = 'https://raw.githubusercontent.com/ryyos/ryyos/refs/heads/main/images/erine/kawaiii.jpeg'
path = 'data/erine_kawai.jpg'
client_kwargs = {
"key": "aws_access_key_id",
"secret": "aws_secret_access_key",
"endpoint_url": "endpoint_url",
}
s3 = s3fs.core.S3FileSystem(**client_kwargs)
CathD.download(
url=url,
path=path,
save=True,
send_s3=True,
s3fs_connection=s3
)
3. Send to S3 with an internal S3FS connection
If you want to send the downloaded file to the S3 with an internal connection or use the function from CathD to establish a connection to the S3, you can also do it like this
from cathd import CathD
url = 'https://raw.githubusercontent.com/ryyos/ryyos/refs/heads/main/images/erine/kawaiii.jpeg'
path = 'data/erine_kawai.jpg'
CathD.build_s3fs(
access_key_id="aws_access_key_id",
secret_access_key="aws_secret_access_key",
endpoint_url="endpoint_url",
bucket="bucket"
)
CathD.download(
url=url,
path=path,
save=True,
send_s3=True,
)
🚀Structure
├── cathd
│ ├── CathD.py
│ ├── __init__.py
│ └── utils.py
├── LICENSE
├── README.md
└── setup.py
Author
👤 Rio Dwi Saputra
- Twitter: @ryyo_cs
- Github: @ryyos
- Instagram: @ryyo.cs
- LinkedIn: @rio-dwi-saputra-23560b287
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
CathD-0.0.2.tar.gz
(8.3 kB
view details)
Built Distribution
CathD-0.0.2-py3-none-any.whl
(8.7 kB
view details)
File details
Details for the file CathD-0.0.2.tar.gz
.
File metadata
- Download URL: CathD-0.0.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 934022326e4ab5e9ab23235ae54b76ac5d07423faecca9ee068d27d04b84cd51 |
|
MD5 | 92465724aced372587a730a4755915be |
|
BLAKE2b-256 | 005e50fcee7ebf1b1e27b186def838717453b57cd19d831b3bd8fcaa56821566 |
File details
Details for the file CathD-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: CathD-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55cdc399a54b7526a3f01ec100f48f21662d5b5e2128815f227e2b7854fd2f7a |
|
MD5 | 338ba48da3fc7c3d3295bbc72d57ca7e |
|
BLAKE2b-256 | c6b6b43aed5fd630c5f9c5ddb922cffa935374a13bdff76a097ab895a142b555 |