docstr: Create a new instance of the PerspectiveHandlerBase with the
  given Manager instance.
  
  Keyword Args:
      manager (:obj:`PerspectiveManager`): A `PerspectiveManager` instance.
          Must be provided on initialization.
      check_origin (:obj`bool`): If True, all requests will be accepted
          regardless of origin. Defaults to False.
      chunk_size (:obj:`int`): Binary messages will not exceed this length
          (in bytes);  payloads above this limit will be chunked
          across multiple messages. Defaults to `16_777_216` (16MB), and
          be disabled entirely with `None`.
docstr_tok: ["Create","a","new","instance","of","the","PerspectiveHandlerBase","with","the","given","Manager","instance",".","Keyword","Args",":","manager","(",":","obj",":","`","PerspectiveManager","`",")",":","A","`","PerspectiveManager","`","instance",".","Must","be","provided","on","initialization",".","check_origin","(",":","obj","`","bool","`",")",":","If","True",",","all","requests","will","be","accepted","regardless","of","origin",".","Defaults","to","False",".","chunk_size","(",":","obj",":","`","int","`",")",":","Binary","messages","will","not","exceed","this","length","(","in","bytes",")",";","payloads","above","this","limit","will","be","chunked","across","multiple","messages",".","Defaults","to","`","16_777_216","`","(","16MB",")",",","and","be","disabled","entirely","with","`","None","`","."]
code: def __init__(self, **kwargs):
      """Create a new instance of the PerspectiveHandlerBase with the
      given Manager instance.
  
      Keyword Args:
          manager (:obj:`PerspectiveManager`): A `PerspectiveManager` instance.
              Must be provided on initialization.
          check_origin (:obj`bool`): If True, all requests will be accepted
              regardless of origin. Defaults to False.
          chunk_size (:obj:`int`): Binary messages will not exceed this length
              (in bytes);  payloads above this limit will be chunked
              across multiple messages. Defaults to `16_777_216` (16MB), and
              be disabled entirely with `None`.
      """
      self._manager = kwargs.pop("manager", None)
      if self._manager is None:
          raise PerspectiveError(
              "A `PerspectiveManager` instance must be provided to the handler!"
          )
  
      self._check_origin = kwargs.pop("check_origin", False)
  
      # uvicorn (used by aiohttp / starlette) defaults to 16MB max payload
      # https://github.com/encode/uvicorn/pull/995/files
      # https://github.com/euri10/uvicorn/blob/8a9369439c15a657a7726eb291858f72d3199c60/tests/protocols/test_websocket.py#L463
      self._chunk_size = kwargs.pop("chunk_size", 16_777_216)
  
      # https://www.tornadoweb.org/en/stable/gen.html#tornado.gen.moment
      self._chunk_sleep = kwargs.pop("_chunk_sleep", 0)
  
      self._session = self._manager.new_session()
      self._stream_lock = asyncio.Lock()
  
file_path: perspective/python/perspective/perspective/handlers/common.py
imports: import asyncio
  from abc import ABC, abstractmethod
  import functools
  from ..core.exception import PerspectiveError
label_desc: Use image node_id 1 to create a new PerspectiveHandlerBase object from inherited base classes: ABC with example: obj = PerspectiveHandlerBase()