caterva2.get_roots#

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

Get the list of available roots.

Parameters:
  • urlbase (str) – The base of URLs of the subscriber to query. The default is caterva2.sub_urlbase_default.

  • auth_cookie (str) – An optional HTTP cookie for authorizing access.

Returns:

A mapping of available root names to their name, http endpoint and whether they are 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}