class_docstr: ClearML API Session class. 
class_docstr_tok: ["ClearML","API","Session","class","."]
docstr: Send a raw batch API request. Batch requests always use application/json-lines content type.
  :param service: service name
  :param action: action name
  :param version: version number (default is the preconfigured api version)
  :param headers: request headers (authorization and content type headers will be automatically added)
  :param json: iterable of json items (batched items, jsonable objects or builtin types constructs). These will
               be sent as a multi-line payload in the request body.
  :param data: iterable of bytes objects (batched items). These will be sent as a multi-line payload in the
               request body.
  :param method: HTTP method
  :return: requests Response instance
docstr_tok: ["Send","a","raw","batch","API","request",".","Batch","requests","always","use","application\/json-lines","content","type",".",":","param","service",":","service","name",":","param","action",":","action","name",":","param","version",":","version","number","(","default","is","the","preconfigured","api","version",")",":","param","headers",":","request","headers","(","authorization","and","content","type","headers","will","be","automatically","added",")",":","param","json",":","iterable","of","json","items","(","batched","items",",","jsonable","objects","or","builtin","types","constructs",")",".","These","will","be","sent","as","a","multi-line","payload","in","the","request","body",".",":","param","data",":","iterable","of","bytes","objects","(","batched","items",")",".","These","will","be","sent","as","a","multi-line","payload","in","the","request","body",".",":","param","method",":","HTTP","method",":","return",":","requests","Response","instance"]
code: def send_request_batch(
      self,
      service,
      action,
      version=None,
      headers=None,
      data=None,
      json=None,
      method=None,
  ):
      """
      Send a raw batch API request. Batch requests always use application/json-lines content type.
      :param service: service name
      :param action: action name
      :param version: version number (default is the preconfigured api version)
      :param headers: request headers (authorization and content type headers will be automatically added)
      :param json: iterable of json items (batched items, jsonable objects or builtin types constructs). These will
                   be sent as a multi-line payload in the request body.
      :param data: iterable of bytes objects (batched items). These will be sent as a multi-line payload in the
                   request body.
      :param method: HTTP method
      :return: requests Response instance
      """
      if not all(
          isinstance(x, (list, tuple, type(None), types.GeneratorType))
          for x in (data, json)
      ):
          raise ValueError(
              "Expecting list, tuple or generator in 'data' or 'json'"
          )
  
      if not data and not json:
          # Missing data (data or json), batch requests are meaningless without it.
          return None
  
      if not method:
          method = Request.def_method
  
      headers = headers.copy() if headers else {}
      headers["Content-Type"] = "application/json-lines"
  
      if data:
          req_data = "\n".join(data)
      else:
          req_data = "\n".join(json_lib.dumps(x) for x in json)
  
      cur = 0
      results = []
      while True:
          size = self.__max_req_size
          slice = req_data[cur : cur + size]
          if not slice:
              break
          if len(slice) < size:
              # this is the remainder, no need to search for newline
              pass
          elif slice[-1] != "\n":
              # search for the last newline in order to send a coherent request
              size = slice.rfind("\n") + 1
              # readjust the slice
              slice = req_data[cur : cur + size]
              if not slice:
                  raise MaxRequestSizeError(
                      "Error: {}.{} request exceeds limit {} > {} bytes".format(
                          service,
                          action,
                          len(req_data),
                          self.__max_req_size,
                      )
                  )
          res = self.send_request(
              method=method,
              service=service,
              action=action,
              data=slice,
              headers=headers,
              version=version,
          )
          results.append(res)
          if res.status_code != requests.codes.ok:
              break
          cur += size
      return results
  
imports: from __future__ import print_function
  import json
  import logging
  import os
  import sys
  import types
  import weakref
  from socket import gethostname
  from time import sleep
  import jwt
  import requests
  import six
  from requests.auth import HTTPBasicAuth
  from requests.exceptions import ChunkedEncodingError, ContentDecodingError, StreamConsumedError
  from six.moves.urllib.parse import urlparse, urlunparse
  from typing import List, Optional
  from .callresult import CallResult
  from .defs import ENV_VERBOSE, ENV_HOST, ENV_ACCESS_KEY, ENV_SECRET_KEY, ENV_WEB_HOST, ENV_FILES_HOST, ENV_OFFLINE_MODE, ENV_AUTH_TOKEN, ENV_DISABLE_VAULT_SUPPORT, ENV_ENABLE_ENV_CONFIG_SECTION, ENV_ENABLE_FILES_CONFIG_SECTION, ENV_API_EXTRA_RETRY_CODES, ENV_API_DEFAULT_REQ_METHOD, ENV_FORCE_MAX_API_VERSION, ENV_IGNORE_MISSING_CONFIG, MissingConfigError
  from .request import Request, BatchRequest
  from .token_manager import TokenManager
  from ..utils import get_http_session_with_retry, urllib_log_warning_setup
  from ...backend_config import ConfigurationError
  from ...backend_config.defs import get_config_file
  from ...debugging import get_logger
  from ...debugging.log import resolve_logging_level
  from ...utilities.pyhocon import ConfigTree, ConfigFactory
  from ...version import __version__
  from ...backend_config.utils import apply_files, apply_environment
label_desc: Use image node_id 17 for calling the Session obj's underlying member method code with example usage: obj.send_request_batch(service, action, version, headers, data, json, method) and returns: results, None