INNER CODE UNIT · Python
forward_with_curl
Kounex/obs_blade · tool/kick_auth_proxy/proxy.py:131
def forward_with_curl(form: dict[str, str]) -> tuple[int, bytes]:
"""POST [form] to Kick. The secret is on curl's stdin, not its argv."""
body = "&".join(
f"{key}={_urlencode(value)}" for key, value in form.items()
).encode()
with tempfile.TemporaryDirectory(prefix="kick-auth-") as directory:
out_path = os.path.join(directory, "body")
completed = subprocess.run(
[
"curl",
"-sS",
"-m",
"20",
"-o",
out_path,
"-w",
"%{http_code}",
"-X",