show urls for new pastes

This commit is contained in:
Morgan McMillian 2021-07-24 10:41:53 -07:00
parent 8d18076ad9
commit 3b035ab9a7

10
srht.py
View file

@ -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')