mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Simplify/explain example code
This commit is contained in:
parent
72e9f786fa
commit
4e6352331f
1 changed files with 2 additions and 1 deletions
|
@ -16,9 +16,10 @@ import sys
|
||||||
def paste_code():
|
def paste_code():
|
||||||
request = urllib2.Request(
|
request = urllib2.Request(
|
||||||
'http://dpaste.de/api/',
|
'http://dpaste.de/api/',
|
||||||
urllib.urlencode([('content', ''.join(sys.stdin.readlines()))]),
|
urllib.urlencode([('content', sys.stdin.read())]),
|
||||||
)
|
)
|
||||||
response = urllib2.urlopen(request)
|
response = urllib2.urlopen(request)
|
||||||
|
# Strip surrounding quotes (NB: response has no trailing newline)
|
||||||
print response.read()[1:-1]
|
print response.read()[1:-1]
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue