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