Sign in New API Help About

Posting to the dpaste.com API with Python

287 bytes of Python
Created 3 years, 11 months ago by dpaste.com — public
Viewed 3,776 times
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}")

Related items


Share: