comparison 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
comparison
equal deleted inserted replaced
157:f145d7b1fbf7 158:c1390e43b437
1 #!/usr/bin/env python
2 import urllib, sys
3
4 if len(sys.argv) == 2:
5 url = "http://%s.pastebin.mozilla.org" % sys.argv[1]
6 fmt = sys.argv[1]
7 else:
8 url = "http://pastebin.mozilla.org"
9 fmt = "None"
10
11 body = sys.stdin.read()
12
13 params = [
14 ('parent_pid', ''),
15 ('code2', body),
16 ('poster', ''),
17 ('expiry', 'd'),
18 ('paste', 'Send'),
19 ('format', fmt),
20 ]
21
22 data = urllib.urlencode(params)
23
24 req = urllib.urlopen(url, data)
25
26 print req.geturl()