CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 52 of file query.py.

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

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

Variable Documentation

string query.dbsInst = "cms_dbs_prod_global"

Definition at line 117 of file query.py.

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

Definition at line 115 of file query.py.

Referenced by edm::service::SiteLocalConfigService.computeStatisticsDestination(), DQMService.DQMService(), EcalTPGParamReaderFromDB.EcalTPGParamReaderFromDB(), dqm::DQMFileSaverPB.fillJson(), dqmfilesaver.fillJson(), XrdAdaptor::Source.getHostname(), popcon::RpcDataS.getNewObjects(), popcon::RpcDataT.getNewObjects(), popcon::RpcDataUXC.getNewObjects(), popcon::RpcDataI.getNewObjects(), popcon::RpcDataV.getNewObjects(), popcon::RpcDataFebmap.getNewObjects(), popcon::RpcDataGasMix.getNewObjects(), popcon::RpcObGasData.getNewObjects(), popcon::RPCObPVSSmapData.getNewObjects(), CSCGeometryESModule.initCSCGeometry_(), DQMNet.listenToCollector(), EcalSeverityLevelESProducer.produce(), EcalNextToDeadChannelESProducer.produce(), RPCInverseOMTFLinkMapESProducer.produce(), RPCInverseTwinMuxLinkMapESProducer.produce(), RPCInverseLBLinkMapESProducer.produce(), RPCInverseCPPFLinkMapESProducer.produce(), EcalLaserCorrectionService.produce(), EcalLaserCorrectionServiceMC.produce(), HcalDbProducer.produce(), HcalTPGCoderULUT.produce(), CastorDbProducer.produce(), CSCGeometryESModule.produce(), DTGeometryESModule.produce(), DTGeometryESProducer.produce(), FFTJetLookupTableESProducer< CT >.produce(), FFTJetCorrectionESProducer< CT >.produce(), HcalDbProducer::TokensForServiceHolder< RecordType, TokenHolders >.setupHcalDbService(), and DQMNet.updateToCollector().

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

Definition at line 132 of file query.py.

tuple query.optManager = DDOptionParser()

Definition at line 118 of file query.py.

query.port = 443

Definition at line 116 of file query.py.

Referenced by edm::service::SiteLocalConfigService.computeStatisticsDestination(), DQMService.DQMService(), EcalTPGParamReaderFromDB.EcalTPGParamReaderFromDB(), DQMNet.listenToCollector(), HCAL_HLX::TCPReceiver.SetPort(), HCAL_HLX::TCPReceiver.TCPReceiver(), and DQMNet.updateToCollector().

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 138 of file query.py.