diskcache-fernet
how to install
$ pip install diskcache-fernet
how to use
from __future__ import annotations
from pathlib import Path
from pickle import UnpicklingError
from tempfile import TemporaryDirectory
from diskcache import Cache
from diskcache_fernet import FernetDisk
def main(temp: Path) -> None:
origin = Cache(temp)
fernet = Cache(temp, disk=FernetDisk)
# or add fernet key
# fernet = Cache(temp, disk=FernetDisk, disk_fernet=b"some fernet key")
fernet["string"] = "value"
fernet["pickle"] = {"key": "value"}
from_fernet_string = fernet["string"]
from_origin_string = origin["string"]
assert from_fernet_string != from_origin_string
assert from_fernet_string == "value"
print(from_origin_string)
# like:
# gAAAAABlGtPWAPEcYLqu6waiUd551H4jfAvQlulWnfwyWTVtjZyF6AkUCVFQKPpIRz9vu29y1FoduIYoK-mOz5CJt0Kx-pv2zQ==
from_fernet_pickle = fernet["pickle"]
assert from_fernet_pickle == {"key": "value"}
try:
origin["pickle"]
except Exception as exc:
assert isinstance(exc, UnpicklingError)
if __name__ == "__main__":
with TemporaryDirectory() as temp:
main(Path(temp))
License
Apache-2.0, see LICENSE.
Metadata
Release files for diskcache-fernet 0.1.6
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 | Actions |
|---|---|---|---|---|
| diskcache_fernet-0.1.6.tar.gz | 26.5 kB | Without provenance | Details for diskcache_fernet-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diskcache_fernet-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for diskcache_fernet-0.1.6-py3-none-any.whl |
Total release size: 42.9 kB
Release files / diskcache_fernet-0.1.6.tar.gz
| Download URL | diskcache_fernet-0.1.6.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
436bfd1aad28691e2bbe9ed7c08fc4b94bf10306d49bf1e60edcb1ab5b59de50
|
|
BLAKE2b-256 checksum How to use checksums |
5f09a65f2725a471c05c45feb23b6891c7f60a34fd0c6d9c01908575405dbef4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.2
|
Release files / diskcache_fernet-0.1.6-py3-none-any.whl
| Download URL | diskcache_fernet-0.1.6-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8d027efa3cf4a77479e248f7a515da60702f380d9996f6c32d514a29eade690
|
|
BLAKE2b-256 checksum How to use checksums |
90d6172eec6c1119e6292bbe03351c19d0f9a690b0db102524a51b67a9e66b04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.2
|
Security for diskcache-fernet 0.1.6
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.