Mercurial > hg > config
annotate python/pbmoz.py @ 694:ebca6d85213a
File "/usr/lib/python3/dist-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/usr/lib/python3/dist-packages/IPython/config/application.py", line 31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "/usr/lib/python3/dist-packages/IPython/config/configurable.py", line 33, in <module>
from IPython.utils.text import indent, wrap_paragraphs
File "/usr/lib/python3/dist-packages/IPython/utils/text.py", line 28, in <module>
from IPython.external.path import path
File "/usr/lib/python3/dist-packages/IPython/external/path/__init__.py", line 2, in <module>
from path import *
File "/home/jhammel/python/path.py", line 25
print root(path)
^
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 09 Jul 2014 16:26:49 -0700 |
parents | c1390e43b437 |
children |
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() |