py-ugs3client

Copyright 2016, 2018 Vsevolod Kolchinsky

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


exception ugs3client.UGS3ClientException

class ugs3client.UGS3Client(host='ugs3.universinet.org', memcache=('localhost', 11211))

UGS3 base level operations client

Usage:

1
2
3
4
from ugs3client import UGS3Client

ugs3 = UGS3Client(host="...",memcache=('localhost',11211))
ugs3.find_containers(name="test")

set memcache=None to disable client-side caching using memcache (not recommended).

__init__(host='ugs3.universinet.org', memcache=('localhost', 11211))
Parameters:
  • host – UGS3 API host
  • memcache – memcached server (host,port) tuple or None
_build_cache_key(*args, **kwargs)
_cache_retrieve(key)
Returns:value or None for cache miss
_cache_store(key, value)
_call_request_func(request_func, method, url, headers, **kwargs)
_get_headers()
_setup_memcache(memcache_cfg)
create_container(**kwargs)

Creates container

Returns:JSON – created container instance
Raises:UGS3ClientException
find_containers(**kwargs)

Query containers

Returns:list – paginated query results
Raises:UGS3ClientException
get_container(container_id)

Get container by id

Parameters:container_id – existing Container id
Returns:JSON – container data
Raises:UGS3ClientException
get_response(method, uri, **kwargs)
Returns:JSON – API response
Raises:UGS3ClientException
login(**kwargs)

Exchange username and password to JWT which would used in further requests.

Parameters:
  • username – UGS account username
  • password – password
Raises:

UGS3ClientException

my_username
Returns:string – currently authenticated username
Raises:UGS3ClientException
set_authorization(auth_value)

Set authentication request header

update_container(container_id, ETag, **kwargs)

Update container

Parameters:
  • container_id – existing Container id
  • ETag – Containers last-known ETag assumed as actual
Returns:

JSON – updated container instance

Raises:

UGS3ClientException


Indices and tables