From 1d7ba5a4177685413d4fe3d01ff176267cdd8572 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Sat, 12 Apr 2014 11:33:41 -0400 Subject: [PATCH] Usage update. --- dpaste/templates/dpaste/about.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpaste/templates/dpaste/about.html b/dpaste/templates/dpaste/about.html index 74b2eb6..dd6551b 100644 --- a/dpaste/templates/dpaste/about.html +++ b/dpaste/templates/dpaste/about.html @@ -25,7 +25,7 @@
  1. #!/usr/bin/env python
  2.  
  3. from urllib import urlencode
  4. from urllib2 import Request, urlopen
  5. from sys import stdin
  6.  
  7. def paste_code():
  8.     request = Request('https://dpaste.de/api/', urlencode({
  9.         'content': stdin.read(),
  10.         'lexer': 'python',
  11.         'format': 'url',
  12.     }))
  13.     print urlopen(request).read()
  14.  
  15. if __name__ == '__main__':
  16.     paste_code()

-

Save this script in /usr/local/bin/dpaste and chmod +x ..filepath.

+

Save this script in /usr/local/bin/dpaste and give it the executable bit: chmod +x /usr/local/bin/dpaste.

Usage: cat foo.txt | dpaste

An alternative would be to just use curl: