a minimal tool for managing client data stored in GCP
Project description
sojourner
Install
pip install sojourner
It is likely that running this project will require a .env with a
bucket name as well as application credentials.
Usage
import json
from sojourner import Sojourner
client = Sojourner()
data = json.dumps({"key": "value"}).encode()
success = client.store("client1", "sample.json", data, manifest="This is a sample JSON blob", version="1.0")
print(f"Store blob success: {success}")
# will fail after first run because overwriting is not allowed
retrieved_data, retrieved_metadata = client.get("client1", "sample.json")
print(f"Retrieved data: {json.loads(retrieved_data.decode())}")
print(f"Retrieved metadata: {retrieved_metadata}")
blob_list = client.list("client1")
print(f"Blob list: {blob_list}")
Store blob success: True
Retrieved data: {'key': 'value'}
Retrieved metadata: Metadata(manifest: This is a sample JSON blob, timestamp: 2024-08-15 16:20:46, content_hash: 9724c1e2..., additional_info: {"version": "1.0"})
Blob list: ['sample.csv', 'sample.json']
Alternatively, the package can be used through its CLI, sj:
# Store a file
sj store sk telco_topics_annotated.json ./local_file.json --manifest "Data containing all summaries, topics, with ground truth scores from SK labelers."
# Retrieve a file
sj get sk telco_topics_annotated.json ./local_file.json
# List files
sj list sk
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sojourner-0.0.6.tar.gz
(11.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sojourner-0.0.6-py3-none-any.whl
(10.1 kB
view details)
File details
Details for the file sojourner-0.0.6.tar.gz.
File metadata
- Download URL: sojourner-0.0.6.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4305446b285342e3f11a7324838b096527247b669b098a55afd5005cef1e1f71
|
|
| MD5 |
0377b9cb64fbedcd5dbaf2090be33289
|
|
| BLAKE2b-256 |
c68c08e230b1cfad124e507d477b9eb1e06efdd25d60c555d87af8568bf3392e
|
File details
Details for the file sojourner-0.0.6-py3-none-any.whl.
File metadata
- Download URL: sojourner-0.0.6-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3830bcf754687a813f509ef6c023ef0d35c045cea3e2b58d53583279633b71b5
|
|
| MD5 |
47239e71e03e9535a5ffac3243d3cdcc
|
|
| BLAKE2b-256 |
326d6b0f0d1141a63cfd287123aeb00d0f84748b3599001faa5635bf527862b5
|