Skip to content

Client

reduct.Client

HTTP Client for Reduct Storage HTTP API

__init__(url, api_token=None, timeout=None)

Constructor

Parameters:

Name Type Description Default
url str

URL to connect to the storage

required
api_token Optional[str]

API token if the storage uses it for authorization

None
timeout Optional[float]

total timeout for connection, request and response in seconds

None

Examples:

>>> client = Client("http://127.0.0.1:8383")
>>> info = await client.info()

create_bucket(name, settings=None, exist_ok=False) async

Create a new bucket

Parameters:

Name Type Description Default
name str

a name for the bucket

required
settings Optional[BucketSettings]

settings for the bucket If None, the server

None
exist_ok

the client raises no exception if the bucket

False

Returns:

Name Type Description
Bucket Bucket

created bucket

Raises:

Type Description
ReductError

if there is an HTTP error

get_bucket(name) async

Load a bucket to work with

Parameters:

Name Type Description Default
name str

name of the bucket

required

Returns:

Type Description
Bucket

Bucket

Raises:

Type Description
ReductError

if there is an HTTP error

info() async

Get high level server info

Returns:

Name Type Description
ServerInfo ServerInfo

Raises:

Type Description
ReductError

if there is an HTTP error

list() async

Return a list of all buckets on server

Returns:

Type Description
List[BucketInfo]

List[BucketInfo]

Raises:

Type Description
ReductError

if there is an HTTP error