1 #!/usr/bin/env python 2 3 """ 4 Fetching the profile of each user from a Confluence site in order to obtain 5 name and e-mail details. 6 7 User details are written to standard output in a tab-separated sequence using 8 the following format: 9 10 USERNAME FULLNAME EMAIL IMAGE-URL 11 """ 12 13 from time import sleep 14 from os.path import split 15 import sys 16 17 this_dir = split(sys.argv[0])[0] 18 sys.path.append(this_dir) 19 20 from get_profile import get_profile 21 22 def main(): 23 progname = split(sys.argv[0])[-1] 24 25 try: 26 url = sys.argv[1] 27 delay = int((sys.argv[2:3] or ["1"])[0]) 28 except (IndexError, ValueError): 29 print >>sys.stderr, "%s <wiki URL> [ <retrieval delay> ]" % progname 30 print >>sys.stderr 31 print >>sys.stderr, "Example: %s http://wiki.list.org/" % progname 32 sys.exit(1) 33 34 line = sys.stdin.readline() 35 while line: 36 username = line.strip() 37 print "\t".join(get_profile(url, username)) 38 39 sleep(delay) 40 line = sys.stdin.readline() 41 42 if __name__ == "__main__": 43 main() 44 45 # vim: tabstop=4 expandtab shiftwidth=4