Log in New API Help About

Using the dpaste.com API with Python

281 bytes of Python
Created 7 months, 2 weeks ago by dpaste.com
https://dpaste.com/GLYYZHHMB
COPY TO CLIPBOARD SOFT WRAP RAW TEXT DUPLICATE DIFF
1
2
3
4
5
6
7
8
# Requires https://requests.readthedocs.io/

import requests

data = {"content": 'print("Hello!")', "syntax": "python", "expiry_days": 1}
headers = {"User-Agent": "My Python Project"}
r = requests.post("https://dpaste.com/api/", data=data, headers=headers)
print(f"URL: {r.text}")

Share: