annotate python/pbmoz.py @ 308:8be2beb2d952

start some keys dont work
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 16 May 2013 16:05:52 -0700
parents c1390e43b437
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
158
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 import urllib, sys
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 if len(sys.argv) == 2:
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 url = "http://%s.pastebin.mozilla.org" % sys.argv[1]
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 fmt = sys.argv[1]
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 else:
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 url = "http://pastebin.mozilla.org"
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 fmt = "None"
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 body = sys.stdin.read()
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 params = [
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 ('parent_pid', ''),
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 ('code2', body),
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 ('poster', ''),
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 ('expiry', 'd'),
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 ('paste', 'Send'),
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 ('format', fmt),
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 ]
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 data = urllib.urlencode(params)
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 req = urllib.urlopen(url, data)
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25
c1390e43b437 point pastebin at pastebin.mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 print req.geturl()