Skip to main content

s3_usecases_npcmr - a set of use cases of boto3 wrapped into a module.

Content

Installation

pip install s3_npcmr

Usage

Create your own class inheriting from ObjectStorage, set params.

from s3_npcmr import ObjectStorage as BaseObjectStorage

class ObjectStorage(BaseObjectStorage):
  S3_SERVICE_NAME = 'YOUR_PARAM'
  S3_ENDPOINT_URL = 'YOUR_PARAM'
  S3_BUCKET = 'YOUR_PARAM'
  REDIS_CONTAINER_NAME = 'YOUR_PARAM'

Upload a file

s3 = ObjectStorage()
s3.upload_file(file_as_bytes, unique_s3_key_for_this_file)

Get metadata

s3 = ObjectStorage()
data = s3.get_metadata(obj.s3_key).get('Metadata', {})
metadata =  {k.lower(): v for k, v in data.items()}

Get hashed links to files

s3 = ObjectStorage()
file_urls['watch'] = s3.get_presigned_url(obj.s3_key)
file_urls['download'] = s3.get_presigned_url(obj.s3_key, 'attachment')

Dependences

  • boto3
  • Redis (241.2 kB)

PYPI

TODO

  • make redis optional

Metadata

Release files for s3-npcmr 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for s3-npcmr 0.0.2
File Size Uploaded Provenance Actions
s3_npcmr-0.0.2.tar.gz 1.8 kB Without provenance Details for s3_npcmr-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for s3-npcmr 0.0.2
File Interpreter ABI Platform Actions
s3_npcmr-0.0.2-py3-none-any.whl Python 3 none any Details for s3_npcmr-0.0.2-py3-none-any.whl

Total release size: 3.5 kB

Release files / s3_npcmr-0.0.2.tar.gz

Download URL s3_npcmr-0.0.2.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
295e8672048376a36227ca56d1ce038fff3c0fb7c1f3abd0e6dc3a7448a420c9
BLAKE2b-256 checksum
How to use checksums
9d3d0a85aff74a1953e1f61e388b480701df6947cbfd30afee3c3dcd71f84b4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / s3_npcmr-0.0.2-py3-none-any.whl

Download URL s3_npcmr-0.0.2-py3-none-any.whl
Size 1.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8edb3ca5e7f8d49c2aff5b716d6d0097141a23f07933f8d9421aba90d9a9e55d
BLAKE2b-256 checksum
How to use checksums
94868828cb99ec6c11e45327f69cc853222ed47422be59ab13c11cd4d5b8ac7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for s3-npcmr 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page