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.4.tar.gz
(10.8 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
File details
Details for the file sojourner-0.0.4.tar.gz.
File metadata
- Download URL: sojourner-0.0.4.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc71b54c2af22a3e52c893da8b3b15df70c18181857cf05f775129edce71eb3
|
|
| MD5 |
02ed45d4d9634826c19ed61091f408b8
|
|
| BLAKE2b-256 |
a5dfd9689a1c463edc9672f90f697cb241e0dcda5443ad850e238d7b90b2d7d9
|
File details
Details for the file sojourner-0.0.4-py3-none-any.whl.
File metadata
- Download URL: sojourner-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.8 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 |
5f75758f28424b83330e2d50b667deec5ee068b83c8943f3b103d2e038217268
|
|
| MD5 |
aa9d09b8a19a89eb983b1e9e9d4d042f
|
|
| BLAKE2b-256 |
3ebd28502daa10ef9353ee96ff93994feced7fbca646ef31f5708191d14851bc
|