Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
http_response=200):
"""
Store a response to the data directory. The ``operation``
should be the name of the operation in the service API (e.g.
DescribeInstances), the ``response_data`` should a value you want
to return from a placebo call and the ``http_response`` should be
the HTTP status code returned from the service. You can add
multiple responses for a given operation and they will be
returned in order.
"""
LOG.debug('save_response: %s.%s', service, operation)
filepath = self.get_new_file_path(service, operation)
LOG.debug('save_response: path=%s', filepath)
data = {'status_code': http_response,
'data': response_data}
with open(filepath, Format.write_mode(self.record_format)) as fp:
self._serializer(data, fp)