docs: def handle_api_exceptions_inter(self, method, *url_parts, **kwargs):
          """The main (middle) part - it is enough if no error occurs."""
          global request_count  # used only in single thread tests - OK # pylint:disable=global-statement
          # log.info("request %s %s", method, '/'.join(url_parts))
          # import pdb; pdb.set_trace()  # NOQA
          api_ver = kwargs.pop('api_ver', None)
          url = self.rest_api_url(*url_parts, api_ver=api_ver)
          # The 'verify' option is about verifying TLS certificates
          kwargs_in = {'timeout': getattr(settings, 'SALESFORCE_QUERY_TIMEOUT', (4, 15)),
                       'verify': True}
          kwargs_in.update(kwargs)
          log.debug('Request API URL: %s', url)
          request_count += 1
          session = self.sf_session
  
          try:
              response = session.request(method, url, **kwargs_in)
          except requests.exceptions.Timeout:
              raise SalesforceError("Timeout, URL=%s" % url)
          if response.status_code == 401:  # Unauthorized
              # Reauthenticate and retry (expired or invalid session ID or OAuth)
              if ('json' in response.headers['content-type']
                      and response.json()[0]['errorCode'] == 'INVALID_SESSION_ID'):
                  token = session.auth.reauthenticate()
                  if 'headers' in kwargs:
                      kwargs['headers'].update(Authorization='OAuth %s' % token)
                  try:
                      response = session.request(method, url, **kwargs_in)
                  except requests.exceptions.Timeout:
                      raise SalesforceError("Timeout, URL=%s" % url)
  
          if response.status_code < 400:  # OK
              # 200 "OK" (GET, POST)
              # 201 "Created" (POST)
              # 204 "No Content" (DELETE)
              # 300 ambiguous items for external ID.
              # 304 "Not Modified" (after conditional HEADER request for metadata),
              return response
          # status codes docs (400, 403, 404, 405, 415, 500)
          # https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/errorcodes.htm
          self.raise_errors(response)