This commit is contained in:
Mirek Kratochvil 2025-10-12 14:07:08 +02:00
parent 18dea37595
commit dc30ac33ec

View file

@ -64,7 +64,7 @@ def do_pastebin_file(file):
# DPASTE API USE RULES: # DPASTE API USE RULES:
# - user-agent must be set properly # - user-agent must be set properly
# - 1 second between requests # - 1 second between requests
trace(f"pasting {file}...") trace(f"sending `{file}' to dpaste...")
r = requests.post( r = requests.post(
DPASTE_URL + "/api/v2/", DPASTE_URL + "/api/v2/",
data={ data={
@ -75,9 +75,9 @@ def do_pastebin_file(file):
}, },
headers={"User-agent": f"patchodon v{VERSION}"}, headers={"User-agent": f"patchodon v{VERSION}"},
) )
time.sleep(1.1)
if r.status_code != 201: if r.status_code != 201:
raise (f"dpaste POST failed for `{file}'") raise (f"dpaste POST failed for `{file}'")
time.sleep(1.1)
return r.headers["location"] + ".txt" return r.headers["location"] + ".txt"
@ -111,7 +111,7 @@ def do_post(args):
trace("posting the header...") trace("posting the header...")
parent_post_id, url = do_post_status( parent_post_id, url = do_post_status(
args, args,
f"{mayline(args.recipient)} {mayline(args.subject)}\n" f"{mayline(args.recipient)}{mayline(args.subject)}"
f"[patchodon hash {full_hash} / {' '.join(short_hashes)}]", f"[patchodon hash {full_hash} / {' '.join(short_hashes)}]",
) )
for fn, pst, hsh, series in zip( for fn, pst, hsh, series in zip(