Permalink
Browse files

initial commit

  • Loading branch information...
oremj committed Jul 16, 2009
1 parent 9208b04 commit ba5f112989d19dcf13736ee7318f388e939830eb
Showing with 27 additions and 0 deletions.
  1. +1 −0 README
  2. +26 −0 pastebinit.py
View
1 README
@@ -0,0 +1 @@
+Ex: ./pastebinit.py -f python -u myname -e f < pastebinit.py
View
@@ -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.