A client for the rstr blob-store.
Project description
rstr-client
A lightweight python
API client for the rstr
blob store.
Installation
You can install the rstr-client
library with pip
pip install rstr-client
Usage
from rstr import Rstr
# Initialise the rstr client with the URL to your rstr server
# and your API Token.
# NOTE: these can be specified as environment variables
# >>> export RSTR_URL="https://my-rstr.rs"
# >>> export RSTR_TOKEN="MY_API_TOKEN"
url = "https://my-rstr.rs"
token = "MY_API_TOKEN"
with Rstr(url=url, token=token) as rstr:
# Add a file to the blob store
refs = rstr.add(["/path/to/my/file.txt"])
# You will get a list of references to your blobs
# e.g. ["f29bc64a9d3732b4b9035125fdb3285f5b6455778edca72414671e0ca3b2e0de"]
# You can then use the reference to retrieve your blob
ref = refs[0]
blob = rstr.get(ref)
print(blob)
# Blob(f29bc64a9d)
print(blob.metadata)
# BlobMetadata('file.txt', 'text/plain', 20 bytes)
# You can access the binary content of the blob with:
# content = blob.content
# The blob can be permanently deleted from the blob store with:
with Rstr(url=url, token=token) as rstr:
rstr.delete(ref)
License
Copyright (c) 2021 giuppep
rstr-client
is made available under the MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rstr-client-0.2.0.tar.gz
(6.3 kB
view details)
Built Distribution
File details
Details for the file rstr-client-0.2.0.tar.gz
.
File metadata
- Download URL: rstr-client-0.2.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/5.11.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ed89c3680a73115533594afb55cabc79f96cd25bb8591fc725fa957b497582f |
|
MD5 | 3aebf6e2d8423a9545e38f68b539b5b2 |
|
BLAKE2b-256 | 825ef27a8bc0a35038973f6bf258639efae3939703c49138ea328860967a1cbd |
File details
Details for the file rstr_client-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: rstr_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/5.11.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0922618a082fb3a19202c6b015079e9c14aaaa45809254554c10eef630b020 |
|
MD5 | 67a61d3d058b4b396e60e40113530367 |
|
BLAKE2b-256 | 0b5d749231a5a39c5aacfdd054a663b56acadb149f96e7f8cb36d8601c831945 |