Date: Tue, 28 May 2013 22:37:16 +0000
Subject: [PATCH] SSL example
---
dpaste/templates/dpaste/about.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dpaste/templates/dpaste/about.html b/dpaste/templates/dpaste/about.html
index 5b011df..e5f0fdc 100644
--- a/dpaste/templates/dpaste/about.html
+++ b/dpaste/templates/dpaste/about.html
@@ -18,13 +18,13 @@
API
{# Just put the script in dpaste and copy the source node #}
- - #!/usr/bin/env python
-
- import urllib
- import urllib2
- import sys
-
- def paste_code():
- request = urllib2.Request(
- 'http://dpaste.de/api/',
- urllib.urlencode([('content', sys.stdin.read())]),
- )
- response = urllib2.urlopen(request)
- # Strip surrounding quotes (NB: response has no trailing newline)
- print response.read()[1:-1]
-
- if __name__ == '__main__':
- paste_code()
+ - #!/usr/bin/env python
-
- import urllib
- import urllib2
- import sys
-
- def paste_code():
- request = urllib2.Request(
- 'https://dpaste.de/api/',
- urllib.urlencode([('content', sys.stdin.read())]),
- )
- response = urllib2.urlopen(request)
- # Strip surrounding quotes (NB: response has no trailing newline)
- print response.read()[1:-1]
-
- if __name__ == '__main__':
- paste_code()
Save this script in /usr/local/bin/dpaste
and chmod +x ..filepath
.
Usage: cat foo.txt | dpaste
Or you could use curl
:
- alias dpaste="curl -F 'content=<-' http://dpaste.de/api/"
+ alias dpaste="curl -F 'content=<-' https://dpaste.de/api/"