caterva2.subscribe#

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

Subscribes to a specified root.

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

  • 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:

Server response as a string.

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}