CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
query Namespace Reference

Classes

class  DDOptionParser
 

Functions

def sendMessage
 

Variables

string dbsInst = "cms_dbs_prod_global"
 
string host = "cmsweb.cern.ch/dbs_discovery/"
 
tuple input = open(opts.input,'r')
 
tuple optManager = DDOptionParser()
 
int port = 443
 
tuple result = sendMessage(host,port,dbsInst,input,opts.page,opts.limit,opts.xml,opts.case,opts.iface,opts.details,opts.cff,opts.verbose)
 

Function Documentation

def query.sendMessage (   host,
  port,
  dbsInst,
  userInput,
  page,
  limit,
  xml = 0,
  case = 'on',
  iface = 'dd',
  details = 0,
  cff = 0,
  debug = 0 
)
   Send message to server, message should be an well formed XML document.

Definition at line 51 of file query.py.

References join(), SiPixelLorentzAngle_cfi.read, and python.rootplot.root2matplotlib.replace().

51 
52 def sendMessage(host,port,dbsInst,userInput,page,limit,xml=0,case='on',iface='dd',details=0,cff=0,debug=0):
53  """
54  Send message to server, message should be an well formed XML document.
55  """
56  if xml: xml=1
57  else: xml=0
58  if cff: cff=1
59  else: cff=0
60  input=urllib.quote(userInput)
61  if debug:
62  httplib.HTTPConnection.debuglevel = 1
63  print "Contact",host,port
64  _port=443
65  if host.find("http://")!=-1:
66  _port=80
67  if host.find("https://")!=-1:
68  _port=443
69  host=host.replace("http://","").replace("https://","")
70  if host.find(":")==-1:
71  port=_port
72  prefix_path=""
73  if host.find("/")!=-1:
74  hs=host.split("/")
75  host=hs[0]
76  prefix_path='/'.join(hs[1:])
77  if host.find(":")!=-1:
78  host,port=host.split(":")
79  port=int(port)
80 # print "\n\n+++",host,port
81  if port==443:
82  http_conn = httplib.HTTPS(host,port)
83  else:
84  http_conn = httplib.HTTP(host,port)
85  if details: details=1
86  else: details=0
87  path='/aSearch?dbsInst=%s&html=0&caseSensitive=%s&_idx=%s&pagerStep=%s&userInput=%s&xml=%s&details=%s&cff=%s&method=%s'%(dbsInst,case,page,limit,input,xml,details,cff,iface)
88  if prefix_path:
89  path="/"+prefix_path+path[1:]
90  http_conn.putrequest('POST',path)
91  http_conn.putheader('Host',host)
92  http_conn.putheader('Content-Type','text/html; charset=utf-8')
93  http_conn.putheader('Content-Length',str(len(input)))
94  http_conn.endheaders()
95  http_conn.send(input)
96 
97  (status_code,msg,reply)=http_conn.getreply()
98  data=http_conn.getfile().read()
99  if debug or msg!="OK":
100  print
101  print http_conn.headers
102  print "*** Send message ***"
103  print input
104  print "************************************************************************"
105  print "status code:",status_code
106  print "message:",msg
107  print "************************************************************************"
108  print reply
109  return data
110 
111 #
112 # main
#
def sendMessage
Definition: query.py:51
static std::string join(char **cmd)
Definition: RemoteFile.cc:18

Variable Documentation

string query.dbsInst = "cms_dbs_prod_global"

Definition at line 116 of file query.py.

tuple query.host = "cmsweb.cern.ch/dbs_discovery/"

Definition at line 114 of file query.py.

Referenced by DBInterface.DBInterface(), DQMService.DQMService(), EcalTPGParamReaderFromDB.EcalTPGParamReaderFromDB(), popcon::RpcDataUXC.getNewObjects(), popcon::RpcDataT.getNewObjects(), popcon::RpcDataS.getNewObjects(), popcon::RpcDataI.getNewObjects(), popcon::RpcDataFebmap.getNewObjects(), popcon::RpcObGasData.getNewObjects(), popcon::RpcDataGasMix.getNewObjects(), popcon::RPCObPVSSmapData.getNewObjects(), and popcon::RpcDataV.getNewObjects().

query.input = open(opts.input,'r')

Definition at line 131 of file query.py.

tuple query.optManager = DDOptionParser()

Definition at line 117 of file query.py.

query.port = 443

Definition at line 115 of file query.py.

Referenced by DQMService.DQMService(), and EcalTPGParamReaderFromDB.EcalTPGParamReaderFromDB().

tuple query.result = sendMessage(host,port,dbsInst,input,opts.page,opts.limit,opts.xml,opts.case,opts.iface,opts.details,opts.cff,opts.verbose)

Definition at line 137 of file query.py.