source: plinkpot/linkpot @ 34

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
Line 
1#!/usr/bin/env python
2
3import urllib
4import re
5
6pot_re = re.compile(r'Your quick url is <a href="(http://linkpot.net/.*?)"')
7
8def 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
14if __name__ == '__main__':
15    import sys
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.