From 3b035ab9a7277d03906d63751e3dde7d82a74311 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 24 Jul 2021 10:41:53 -0700 Subject: [PATCH] show urls for new pastes --- srht.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/srht.py b/srht.py index d54d4d4..722ec92 100644 --- a/srht.py +++ b/srht.py @@ -123,8 +123,14 @@ def submit_paste(visibility, filename): payload['files'] = [blob] r = requests.post(url, headers=headers, json=payload) - print(r.status_code) - print(r.text) + if r.status_code == 201: + info = r.json() + print(f"https://paste.sr.ht/{info['user']['canonical_name']}/{info['sha']}") + for blob in info['files']: + print(f"https://paste.sr.ht/blob/{blob['blob_id']}") + else: + print(r.status_code) + print(r.text) @paste.command("delete") @click.argument('sha')