show urls for new pastes

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

View file

@ -123,6 +123,12 @@ def submit_paste(visibility, filename):
payload['files'] = [blob] payload['files'] = [blob]
r = requests.post(url, headers=headers, json=payload) r = requests.post(url, headers=headers, json=payload)
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.status_code)
print(r.text) print(r.text)