# sojourner


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

## Install

``` sh
pip install sojourner
```

It is likely that running this project will require a `.env` with a
bucket name as well as application credentials.

## Usage

``` python
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`:

``` bash
# 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
```
