left4me/l4d2web/services/spec_yaml.py
2026-05-05 23:47:06 +02:00

13 lines
357 B
Python

import os
import tempfile
from pathlib import Path
import yaml
def write_temp_spec(payload: dict) -> Path:
handle, filename = tempfile.mkstemp(prefix="l4d2-spec-", suffix=".yaml")
path = Path(filename)
with os.fdopen(handle, "w", encoding="utf-8") as file_obj:
file_obj.write(yaml.safe_dump(payload, sort_keys=False))
return path