def handle_decompression_event(self, event): with open(event["local_path"], "wb") as output_obj: rohmufile.read_file( input_obj=BytesIO(event["blob"]), output_obj=output_obj, metadata=event.get("metadata"), key_lookup=config.key_lookup_for_site(self.config, event["site"]), log_func=self.log.debug, ) if "callback_queue" in event: event["callback_queue"].put({"success": True, "opaque": event.get("opaque")})
def _download_key_to_file(self, key, f) -> bool: raw_metadata: dict = self.storage.get_metadata_for_key(key) with tempfile.TemporaryFile( dir=self.config.temporary_directory) as temp_file: self.storage.get_contents_to_fileobj(key, temp_file) temp_file.seek(0) rohmufile.read_file(input_obj=temp_file, output_obj=f, metadata=raw_metadata, key_lookup=self._private_key_lookup, log_func=logger.debug) return True