mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-19 08:09:38 +11:00
Merge pull request #1 from mgedmin/doc-improvements
Doc improvements: simplify Python code, show shell one-liner alternative
This commit is contained in:
commit
f479fd6614
1 changed files with 6 additions and 1 deletions
|
@ -16,9 +16,10 @@ import sys
|
|||
def paste_code():
|
||||
request = urllib2.Request(
|
||||
'http://dpaste.de/api/',
|
||||
urllib.urlencode([('content', ''.join(sys.stdin.readlines()))]),
|
||||
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__':
|
||||
|
@ -26,6 +27,10 @@ if __name__ == '__main__':
|
|||
|
||||
<p>Save this script in <code>/usr/local/bin/dpaste</code> and <code>chmod +x ..filepath</code>.</p>
|
||||
<p>Usage: <code>cat foo.txt | dpaste</code></p>
|
||||
|
||||
<p>Or you could use <code>curl</code>:
|
||||
<code>alias dpaste="curl -F 'content=<-' http://dpaste.de/api/</code></p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue