class_docstr: BoxApp integration
class_docstr_tok: ["BoxApp","integration"]
docstr: Make the request using the Box client
  
  The inner function of `_perform_request` is used to handle a single retry in
  the event of a ConnectionError. If this fails twice, the function will return
  
  Returns:
      dict: Response from Box (boxsdk.session.box_session.BoxResponse) that is
          json loaded into a dictionary.
docstr_tok: ["Make","the","request","using","the","Box","client","The","inner","function","of","`","_perform_request","`","is","used","to","handle","a","single","retry","in","the","event","of","a","ConnectionError",".","If","this","fails","twice",",","the","function","will","return","Returns",":","dict",":","Response","from","Box","(","boxsdk.session.box_session.BoxResponse",")","that","is","json","loaded","into","a","dictionary","."]
code: def _make_request(self):
      """Make the request using the Box client
  
      The inner function of `_perform_request` is used to handle a single retry in
      the event of a ConnectionError. If this fails twice, the function will return
  
      Returns:
          dict: Response from Box (boxsdk.session.box_session.BoxResponse) that is
              json loaded into a dictionary.
      """
      # Create the parameters for this request, 100 is the max value for limit
      params = {
          "limit": self._MAX_CHUNK_SIZE,
          "stream_type": EnterpriseEventsStreamType.ADMIN_LOGS,
      }
  
      # From Box's docs: Box responds to the created_before and created_after
      # parameters only if the stream_position parameter is not included.
      if self._next_stream_position:
          params["stream_position"] = self._next_stream_position
      else:
          params["created_after"] = self._last_timestamp
  
      LOGGER.debug("[%s] Requesting events", self)
  
      def _perform_request(timeout, allow_retry=True, retry_count=0):
          try:
              # Get the events using a make_request call with the box api. This is to
              # support custom parameters such as 'created_after' and 'created_before'
              box_response = self._client.make_request(
                  "GET",
                  self._client.get_url("events"),
                  params=params,
                  timeout=timeout,
              )
          except BoxException:
              LOGGER.exception("[%s] Failed to get events", self)
              return (
                  False,
                  {},
              )  # Return a tuple to conform to return value of safe_timeout
          except requests.exceptions.Timeout:
              # Retry requests that timed out a few more times, with increased timeout
              timeout *= 2
              LOGGER.debug(
                  "Attempting new request with timeout: %0.2f seconds",
                  timeout,
              )
              if retry_count == self._MAX_RETRY_COUNT:
                  raise  # eventually give up and raise this
              return _perform_request(
                  timeout, allow_retry, retry_count + 1
              )
          except requests.exceptions.ConnectionError:
              # In testing, the requests connection seemed to get reset for no
              # obvious reason, and a simple retry once works fine so catch it
              # and retry once, but after that return False
              LOGGER.exception(
                  "Bad response received from host, will retry once"
              )
              if allow_retry:
                  return _perform_request(timeout, allow_retry=False)
  
              return (
                  False,
                  {},
              )  # Return a tuple to conform to return value of safe_timeout
  
          # Return a successful status and the JSON from the box response
          # Return a tuple to conform to return value of safe_timeout
          return True, box_response.json()
  
      return _perform_request(self._DEFAULT_REQUEST_TIMEOUT)
  
file_path: streamalert/streamalert/apps/_apps/box.py
imports: import json
  from boxsdk import Client, JWTAuth
  from boxsdk.exception import BoxException
  from boxsdk.object.events import EnterpriseEventsStreamType
  import requests
  from .None import AppIntegration, StreamAlertApp, get_logger, safe_timeout
label_desc: Use image node_id 7 for calling the BoxApp obj's underlying member method code with example usage: obj._make_request() and returns: _perform_request, True,  box_response, False,  dict, _perform_request, False,  dict, _perform_request