Mercurial > hg > config
comparison python/pastebin.py @ 37:6b8573a62cd3
add a python pastebin script for mozilla (pastebinit strangely doesnt seem to work at all)
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Thu, 18 Mar 2010 17:25:10 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 36:d83f35b9b799 | 37:6b8573a62cd3 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import sys | |
| 4 import urllib2 | |
| 5 import urllib | |
| 6 content = sys.stdin.read() | |
| 7 url = 'http://pastebin.com/api_public.php' | |
| 8 data = dict(paste_code=content, paste_subdomain='mozilla') | |
| 9 values = urllib.urlencode(data) | |
| 10 req = urllib2.Request(url, values) | |
| 11 response = urllib2.urlopen(req) | |
| 12 the_page = response.read() | |
| 13 | |
| 14 print the_page |
