2019-06-01 14:07:48 -04:00
2019-03-10 10:00:36 -04:00
2019-03-10 10:00:36 -04:00
2019-03-23 15:17:18 -04:00
2019-03-09 18:41:56 -05:00
2019-06-01 14:07:48 -04:00
2019-03-10 10:00:36 -04:00

CodeFactor GitHub

ws_bucket_client

Python client for ws_bucket

Usage (Library)

git submodule add https://github.com/simon987/ws_bucket_client
python -m pip install -r ws_bucket_client/requirements.txt

In your project

import datetime
from ws_bucket_client.api import WsBucketApi

WSB_API = "http://exemple-api-url/"
WSB_SECRET = "exemple_secret"  # Set to None for non-administrative usage
    
ws_bucket = WsBucketApi(WSB_API, WSB_SECRET)

# Allocate bucket (Requires secret)
ws_bucket.allocate(
    token="aj8209x48m",
    file_name="tmp_file.ndjson",
    max_size=1024 * 1024,
    upload_hook="rclone copy $1 my_gdrive:/wsb_tmp && rm $1",
    to_dispose_date=int(datetime.datetime.now().timestamp()) + 4000
  )

# Get bucket data
ws_bucket.read(token="aj8209x48m")

# Upload data to bucket, will trigger upload_hook
with open("my_file.ndjson", "rb") as f:
    ws_bucket.upload(token="aj8209x48m", stream=f, max_size=100000)
Description
No description provided
Readme GPL-3.0 40 KiB
Languages
Python 100%