parameters: (self, method, body=None, params=None)
docstring: Submits a network requests and waits for a response.
  
          Arguments:
  
              method - the function to be called to execute the request.
  
              body - the json content submitted with the request
  
              params - query string parameters sent with the request
  
          Returns:
  
              The json content from response wrapped by a Data object. The returned
              object will have a PATH attribute that is this path object and a RESPONSE
              attribute that is the response object for the http request. The Data
              object will be read only.
docstring_summary: Submits a network requests and waits for a response.
docstring_tokens: Submits a network requests and waits for a response .
function: def __service_request(self, method, body=None, params=None):
          """Submits a network requests and waits for a response.
  
          Arguments:
  
              method - the function to be called to execute the request.
  
              body - the json content submitted with the request
  
              params - query string parameters sent with the request
  
          Returns:
  
              The json content from response wrapped by a Data object. The returned
              object will have a PATH attribute that is this path object and a RESPONSE
              attribute that is the response object for the http request. The Data
              object will be read only.
  
          """
  
          if self.__config.session:
              if self.__config.role_arn:
                  sts = self._get_sts_client()
  
                  res = sts.assume_role(
                      RoleArn=self.__config.role_arn,
                      RoleSessionName=self.__config.role_session_name or 'cgf_service_client'
                  )
  
                  access_key = res['Credentials']['AccessKeyId']
                  secret_key = res['Credentials']['SecretAccessKey']
                  session_token = res['Credentials']['SessionToken']
                  auth_description = self.__config.role_arn
  
              else:
                  session_credentials = self.__config.session.get_credentials().get_frozen_credentials()
  
                  access_key = session_credentials.access_key
                  secret_key = session_credentials.secret_key
                  session_token = session_credentials.token
                  auth_description = 'session'
  
              auth = requests_aws4auth.AWS4Auth(
                  access_key,
                  secret_key,
                  self.__config.session.region_name,
                  'execute-api',
                  session_token=session_token
              )
  
          else:
              auth = None
              auth_description = None
  
          if self.__config.verbose:
              print('HTTP', method.__name__.upper(), self.__url, params, body, auth_description)
  
          response = method(self.__url, params=params, json=body, auth=auth)
  
          if self.__config.verbose:
              print('  -->', response.status_code, response.text)
  
          error.HttpError.for_response(response)
  
          if response.content:
              result = response.json()
  
              # TODO: the generated api gateway lambda dispatch mapping injects this 'result' thing
              # in there, it shouldn't do this because it breaks the contract defined by the swagger.
              # To fix it, we need to:
              #
              # 1) change swagger_processor.lambda_dispatch to return the response provided by the
              # lambda directly. Problem is that breaks the additional_response_template_content feature,
              # which can probably be removed all together.
              #
              # 2) change the c++ client generator handle the missing result property
              #
              # 3) change cgp to handle the missing result property
              #
              # 4) remove the following code
              #
              result = result.get('result', None)
              if result is None:
                  return RuntimeError('Service response did not include the stupid result property.')
              #
              # END TODO
  
              # Data assumes the result is a dict, for responses that don't return a dict
              # try packing into dict
              if not isinstance(result, dict) and self.__config.repack:
                  result = {'Result': result}
                  if self.__config.verbose:
                      print(f'  --> Repacked response as {result}')
  
              return Data(result, read_only=True, PATH=self, RESPONSE=response)
  
          else:
              return None
function_tokens: def __service_request ( self , method , body = None , params = None ) : if self . __config . session : if self . __config . role_arn : sts = self . _get_sts_client ( ) res = sts . assume_role ( RoleArn = self . __config . role_arn , RoleSessionName = self . __config . role_session_name or 'cgf_service_client' ) access_key = res [ 'Credentials' ] [ 'AccessKeyId' ] secret_key = res [ 'Credentials' ] [ 'SecretAccessKey' ] session_token = res [ 'Credentials' ] [ 'SessionToken' ] auth_description = self . __config . role_arn else : session_credentials = self . __config . session . get_credentials ( ) . get_frozen_credentials ( ) access_key = session_credentials . access_key secret_key = session_credentials . secret_key session_token = session_credentials . token auth_description = 'session' auth = requests_aws4auth . AWS4Auth ( access_key , secret_key , self . __config . session . region_name , 'execute-api' , session_token = session_token ) else : auth = None auth_description = None if self . __config . verbose : print ( 'HTTP' , method . __name__ . upper ( ) , self . __url , params , body , auth_description ) response = method ( self . __url , params = params , json = body , auth = auth ) if self . __config . verbose : print ( '  -->' , response . status_code , response . text ) error . HttpError . for_response ( response ) if response . content : result = response . json ( ) # TODO: the generated api gateway lambda dispatch mapping injects this 'result' thing # in there, it shouldn't do this because it breaks the contract defined by the swagger. # To fix it, we need to: # # 1) change swagger_processor.lambda_dispatch to return the response provided by the # lambda directly. Problem is that breaks the additional_response_template_content feature, # which can probably be removed all together. # # 2) change the c++ client generator handle the missing result property # # 3) change cgp to handle the missing result property # # 4) remove the following code # result = result . get ( 'result' , None ) if result is None : return RuntimeError ( 'Service response did not include the stupid result property.' ) # # END TODO # Data assumes the result is a dict, for responses that don't return a dict # try packing into dict if not isinstance ( result , dict ) and self . __config . repack : result = { 'Result' : result } if self . __config . verbose : print ( f'  --> Repacked response as {result}' ) return Data ( result , read_only = True , PATH = self , RESPONSE = response ) else : return None