caterva2.get_roots#

caterva2.get_roots(urlbase=None, auth_cookie=None)#

Retrieves the list of available roots.

Parameters:
  • urlbase (str, optional) – Base URL of the subscriber to query. Default to caterva2.sub_urlbase_default.

  • auth_cookie (str, optional) – HTTP cookie used for authorization.

Returns:

Dictionary mapping available root names to their details: - name: the root name - http: the HTTP endpoint - subscribed: whether it is subscribed or not.

Return type:

dict

Examples

>>> import caterva2 as cat2
>>> roots_dict = cat2.get_roots("https://demo.caterva2.net")
>>> sorted(roots_dict.keys())
['@public', 'b2tests', 'example', 'h5example', 'h5lung_j2k', 'h5numbers_j2k']
>>> cat2.subscribe('b2tests', "https://demo.caterva2.net")
'Ok'
>>> roots_dict['b2tests']
{'name': 'b2tests', 'http': 'localhost:8014', 'subscribed': True}