s3-reader
Python library to read S3 file as local file.
Requirement
- Python >=3.9
Installation
$ pip install s3-reader
Usage
from s3_reader import File
def check_s3_file(path):
file = File(path)
with open(file.path) as f:
...
check_s3_file('s3://<bucket>/path/to/file')
In this example, the S3 file is downloaded when file = File(path) is
executed, and it is stored as a temporary file.
file.path refers to the path of the locally stored temporary file.
At the end of the check_s3_file function, the file object is deleted, and
consequently, the temporary file is also deleted.
If path refers to a local file instead of an S3 file, File simply copies the path, and you can use the File object in the same manner.
You can pass following parameters to File constructor to setup AWS credential:
profile_name : str | None
AWS profile name.
aws_access_key_id : str | None
AWS access key id.
aws_secret_access_key : str | None
AWS secret access key.
aws_session_token : str | None
AWS session token.
region_name : str | None
AWS region name.
role_arn : str | None
AWS role arn for Assume role. If this is set, aws_access_key_id,
aws_secret_access_key, aws_session_token are replaced by Assume role.
session_name : str
AWS session name. Default is "s3_reader".
retry_mode : str
Retry mode for failed requests. Default is "standard".
max_attempts : int
Maximum number of retry attempts for failed requests. Default is 10.
use_device_code : bool
Whether to use device code flow for SSO login. Default is False.
max_trials : int
Maximum number of trials to retry after retrieving credential error.
Default is 10.
Metadata
Release files for s3-reader 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| s3_reader-0.4.0.tar.gz | 4.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| s3_reader-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / s3_reader-0.4.0.tar.gz
| Download URL | s3_reader-0.4.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f6e62515260570c8c55d8e9ef2831d6af1f1e2e1c77a83f92d02c8f4daa9c5b
|
|
BLAKE2b-256 checksum How to use checksums |
0f6b6fee1d7ceeeb9f345bb88bef898944e86f4ccf59758134c141d241dae0bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / s3_reader-0.4.0-py3-none-any.whl
| Download URL | s3_reader-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39319f6f05f57c5c82d4e0c2433c8385321791eabe462cf143679367915faecb
|
|
BLAKE2b-256 checksum How to use checksums |
eadb48fdf6db5f57a6f6417967af4c7ae17bcbd08b939c933b79c9807c775832
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Security for s3-reader 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.