Last change
on this file since 34 was
34,
checked in by simon, 17 years ago
|
- Exit quietly, at least until options for debug output/suppressing errors
are added.
|
-
Property svn:executable set to
*
|
File size:
443 bytes
|
Rev | Line | |
---|
[33] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import urllib |
---|
| 4 | import re |
---|
| 5 | |
---|
| 6 | pot_re = re.compile(r'Your quick url is <a href="(http://linkpot.net/.*?)"') |
---|
| 7 | |
---|
| 8 | def linkpot(url): |
---|
| 9 | post_data = urllib.urlencode({'url': url}) |
---|
| 10 | res = urllib.urlopen('http://linkpot.net/add/', post_data).read() |
---|
| 11 | pot = pot_re.search(res).group(1) |
---|
| 12 | return pot |
---|
| 13 | |
---|
| 14 | if __name__ == '__main__': |
---|
| 15 | import sys |
---|
[34] | 16 | try: |
---|
| 17 | print linkpot(sys.argv[1]) |
---|
| 18 | except Exception: |
---|
| 19 | sys.exit(1) |
---|
Note: See
TracBrowser
for help on using the repository browser.