13 if os.environ[
'DBS_LIKE'] ==
"LOCAL":
14 fileIn = open(
"Listfiles.txt",
"r")
15 line = fileIn.readline()
18 for fragment
in line.split(
"\n"):
20 result.append(fragment)
21 line = fileIn.readline()
23 url =
"https://cmsweb.cern.ch:443/dbs_discovery/aSearch"
24 input =
"find file where release = " + os.environ[
'DBS_RELEASE']
25 input = input +
" and primds = " + os.environ[
'DBS_SAMPLE']
26 input = input +
" and dataset like " + os.environ[
'DBS_LIKE']
27 final_input = urllib.quote(input) ;
29 agent =
"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)"
31 headers = {
'User-Agent':agent,
'Accept':ctypes}
32 params = {
'dbsInst':
'cms_dbs_prod_global',
33 'html':0,
'caseSensitive':
'on',
'_idx':0,
'pagerStep':-1,
34 'userInput':final_input,
35 'xml':0,
'details':0,
'cff':0,
'method':
'dbsapi'}
36 data = urllib.urlencode(params,doseq=
True)
37 req = urllib2.Request(url, data, headers)
41 response = urllib2.urlopen(req)
42 data = response.read()
43 except urllib2.HTTPError
as e:
52 for line
in data.split(
"\n"):
53 if line !=
"" and line[0] ==
"/":