Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
oremj committed Jul 16, 2009
1 parent 9208b04 commit ba5f112
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions README
@@ -0,0 +1 @@
Ex: ./pastebinit.py -f python -u myname -e f < pastebinit.py
26 changes: 26 additions & 0 deletions pastebinit.py
@@ -0,0 +1,26 @@
#!/usr/bin/python

import sys
from optparse import OptionParser
from urllib import urlopen, urlencode

parser = OptionParser()

parser.add_option("-u", "--username", dest="username", default="anonymous")
parser.add_option("-f", "--format", dest="format", default="text", help="defines data format e.g, php")
parser.add_option("-e", "--expiry", dest="expiry", default="m", help="valid options are d, m, f (day, month, forever)")

(options, args) = parser.parse_args()

PASTEBIN_URL = 'http://pastebin.mozilla.org/'

pastebin_data = {
'code2': sys.stdin.read(),
'expiry': options.expiry,
'format': options.format,
'parent_pid': '',
'paste': 'Send',
'poster': options.username
}

print urlopen(PASTEBIN_URL, urlencode(pastebin_data)).geturl()

0 comments on commit ba5f112

Please sign in to comment.