Update README.md

main
cynic 4 years ago committed by GitHub
parent 303b4bcf33
commit a630bc8df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      README.md

@ -2,3 +2,28 @@ endpoint | parameters | response
--- | --- | --- --- | --- | ---
POST / | paste (text to upload) | `text/plain` link to new page POST / | paste (text to upload) | `text/plain` link to new page
GET /pastes/* | n/a | `text/plain` body of the paste GET /pastes/* | n/a | `text/plain` body of the paste
example of cli script using python:
```
#!/usr/bin/env python
PASTESERVER_URL = "http://paste.mydoma.in"
import requests
import sys
f = None
try:
f = open(sys.argv[1], "r")
except FileNotFoundError:
print("file does not exist");sys.exit(2)
fr = f.read()
if fr == "": sys.exit(1)
r = None
try:
r = requests.post(PASTESERVER_URL, data={"paste": fr})
except:
print("error querying server");sys.exit(3)
f.close()
print(r.text)
```

Loading…
Cancel
Save