13 Just a draft of the real program...It is very ugly still.
17 from os.path
import basename
18 from optparse
import OptionParser
21 from urllib2
import Request,build_opener,urlopen
24 if os.environ.has_key(
"RELMON_SA"):
25 from authentication
import X509CertOpen
26 from definitions
import server
27 from utils
import wget
29 from Utilities.RelMon.authentication
import X509CertOpen
31 from Utilities.RelMon.utils
import wget
35 for line
in page_html.split(
"<tr><td>")[1:]:
38 link_start=line.find(
"href='")+6
39 link_end=line.find(
"'>")
42 name_end=line.find(
"</a>")
44 contents.append(the_server+line[link_start:link_end])
46 contents.append(line[name_start:name_end])
50 """ Get the web page listing the rootfiles. Use the X509 auth.
53 datareq = Request(url)
54 datareq.add_header(
'authenticated_wget',
"The ultimate wgetter")
55 filename=basename(url)
56 return opener.open(datareq).
read()
58 if __name__==
"__main__":
60 parser = OptionParser(usage=
"usage: %prog [options] dirtolist")
62 parser.add_option(
"-d",
"--dev",
66 help=
"Select the development GUI instance.")
68 parser.add_option(
"--offline",
72 help=
"Select the Offline GUI instance.")
74 parser.add_option(
"-o",
"--online",
78 help=
"Select the Online GUI instance.")
80 parser.add_option(
"-r",
"--relval",
84 help=
"Select the RelVal GUI instance.")
86 parser.add_option(
"-u",
"--show_url",
90 help=
"Show the full URL of the file.")
92 parser.add_option(
"-g",
"--get",
96 help=
"Get the files.")
98 parser.add_option(
"-p",
"--path",
102 help=
"The path to be matched before getting.")
104 (options, args) = parser.parse_args()
106 if not(options.development
or options.offline
or options.online
or options.relval):
107 print "Select development or online instance!"
112 print "Please specify only one directory to list!"
122 if options.development:
126 directory=
"%s/dqm/%s/data/browse/%s" %(server,mode,dirtolist)
127 print "peeping ",directory
131 print "No contents found!"
133 for content
in contents:
134 if not options.get
and search(options.path,content):
136 if options.get
and options.show_url
and len(options.path)>0
and search(options.path,content):
137 if not search(
'pre',options.path)
and search(
'pre',content):
139 bcontent=basename(content)
140 print "Getting %s" %bcontent
142 print "Got %s!!" %bcontent
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)