caterva2.subscribe#

caterva2.subscribe(root, urlbase=None, auth_cookie=None)#

Subscribe to a root.

Parameters:
  • root (str) – The name of the root to subscribe to.

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

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

Returns:

The response from the server.

Return type:

str

Examples

>>> import caterva2 as cat2
>>> urlbase = 'https://demo.caterva2.net'
>>> root_name = 'h5numbers_j2k'
>>> cat2.subscribe(root_name, urlbase)
'Ok'
>>> cat2.get_roots(urlbase)[root_name]
{'name': 'h5numbers_j2k', 'http': 'localhost:8011', 'subscribed': True}