Skip to main content

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.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sojourner-0.0.5-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file sojourner-0.0.5.tar.gz.

File metadata

  • Download URL: sojourner-0.0.5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for sojourner-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e70fe7a7c558423d15996f17a74968f262bb3e7e4cb09595ad0b27d91c839eb6
MD5 18be66e3ef2d7a46685092b9eb6ae464
BLAKE2b-256 485e1bc94c7b50a6be5fa849f27426f3dd5d349207a648426620edd043b76058

See more details on using hashes here.

File details

Details for the file sojourner-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: sojourner-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for sojourner-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 78cd5b2b0f254e094cc1a130899513aea783aa66ba7d1e96a0790f9c73d8b389
MD5 62973baa500b365a52e789745075d429
BLAKE2b-256 64fee3ab7a89d9b7e53436b02c47325b22ec434c76f454f2c0964ef59fe2837f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page