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 store_blob, get_blob, list_blobs, Metadata
data = json.dumps({"key": "value"}).encode()
metadata = Metadata(manifest="This is a sample JSON blob", additional_info={"version": "1.0"})
success = store_blob("client1", "sample.json", data, metadata)
print(f"Store blob success: {success}")
retrieved_data, retrieved_metadata = get_blob("client1", "sample.json")
print(f"Retrieved data: {json.loads(retrieved_data.decode())}")
print(f"Retrieved metadata: {retrieved_metadata}")
blob_list = list_blobs("client1")
print(f"Blob list: {blob_list}")
ImportError: cannot import name 'store_blob' from 'sojourner' (/Users/shy/projects/sojourner_code/sojourner/__init__.py)
[0;31m---------------------------------------------------------------------------[0m
[0;31mImportError[0m Traceback (most recent call last)
Cell [0;32mIn[8], line 3[0m
[1;32m 1[0m [38;5;28;01mimport[39;00m [38;5;21;01mjson[39;00m
[0;32m----> 3[0m [38;5;28;01mfrom[39;00m [38;5;21;01msojourner[39;00m [38;5;28;01mimport[39;00m store_blob, get_blob, list_blobs, Metadata
[1;32m 5[0m data [38;5;241m=[39m json[38;5;241m.[39mdumps({[38;5;124m"[39m[38;5;124mkey[39m[38;5;124m"[39m: [38;5;124m"[39m[38;5;124mvalue[39m[38;5;124m"[39m})[38;5;241m.[39mencode()
[1;32m 6[0m metadata [38;5;241m=[39m Metadata(manifest[38;5;241m=[39m[38;5;124m"[39m[38;5;124mThis is a sample JSON blob[39m[38;5;124m"[39m, additional_info[38;5;241m=[39m{[38;5;124m"[39m[38;5;124mversion[39m[38;5;124m"[39m: [38;5;124m"[39m[38;5;124m1.0[39m[38;5;124m"[39m})
[0;31mImportError[0m: cannot import name 'store_blob' from 'sojourner' (/Users/shy/projects/sojourner_code/sojourner/__init__.py)
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.1.tar.gz
(8.9 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.1.tar.gz.
File metadata
- Download URL: sojourner-0.0.1.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee2dcc2559ab2b61c9d5c08f1c3ae8c5f25a013e511f5f48c11ffccce53ed133
|
|
| MD5 |
dd198f1e0f0026bb854531515bc45736
|
|
| BLAKE2b-256 |
80b28e6716062cf8906e21316b1ae44a233781039143da558d1d902c80a81bf0
|
File details
Details for the file sojourner-0.0.1-py3-none-any.whl.
File metadata
- Download URL: sojourner-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.3 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 |
bcadbdf389c591f566dbd7685c362aa94aa548a3f8ad80096a2cdcd3999e922c
|
|
| MD5 |
1b4651bf3e82221236ab8569915c47f9
|
|
| BLAKE2b-256 |
ad77d4dfb8c5c85692bda4a0fc9bfbeded34008d63e5fb0ed9200c46a85ee5ab
|