diff python/pbmoz.py @ 158:c1390e43b437

point pastebin at pastebin.mozilla
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 28 Jul 2011 09:18:15 -0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/pbmoz.py	Thu Jul 28 09:18:15 2011 -0700
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+import urllib, sys
+
+if len(sys.argv) == 2:
+    url = "http://%s.pastebin.mozilla.org" % sys.argv[1]
+    fmt = sys.argv[1]
+else:
+    url = "http://pastebin.mozilla.org"
+    fmt = "None"
+
+body = sys.stdin.read()
+
+params = [
+    ('parent_pid', ''),
+    ('code2', body),
+    ('poster', ''),
+    ('expiry', 'd'),
+    ('paste', 'Send'),
+    ('format', fmt),
+    ]
+
+data = urllib.urlencode(params)
+
+req = urllib.urlopen(url, data)
+
+print req.geturl()
\ No newline at end of file