Send query along to Nagios.
323974
def _status_query(query, hostname, enumerate=None, service=None):
    '''
    
    '''
    config = _config()

    data = None
    params = {
        'hostname': hostname,
        'query': query,
    }

    ret = {
        'result': False
    }

    if enumerate:
        params['formatoptions'] = 'enumerate'
    if service:
        params['servicedescription'] = service

    if config['username'] and config['password'] is not None:
        auth = (config['username'], config['password'],)
    else:
        auth = None

    try:
        result = salt.utils.http.query(
            config['url'],
            method='GET',
            params=params,
            decode=True,
            data=data,
            text=True,
            status=True,
            header_dict={},
            auth=auth,
            backend='requests',
            opts=__opts__,
        )
    except ValueError:
        ret['error'] = 'Please ensure Nagios is running.'
        ret['result'] = False
        return ret

    if result.get('status', None) == salt.ext.six.moves.http_client.OK:
        try:
            ret['json_data'] = result['dict']
            ret['result'] = True
        except ValueError:
            ret['error'] = 'Please ensure Nagios is running.'
    elif result.get('status', None) == salt.ext.six.moves.http_client.UNAUTHORIZED:
        ret['error'] = 'Authentication failed. Please check the configuration.'
    elif result.get('status', None) == salt.ext.six.moves.http_client.NOT_FOUND:
        ret['error'] = 'URL {0} was not found.'.format(config['url'])
    else:
        ret['error'] = 'Results: {0}'.format(result.text)

    return ret
1341071
def build_gemini_query(self, query, extra_info):
        
        if 'WHERE' in query:
            return "{0} AND {1}".format(query, extra_info)
        else:
            return "{0} WHERE {1}".format(query, extra_info)
1022176
function send(config, query) {
  if (!config.url) {
    return Promise.reject(new Error('config.url is required'));
  }
  const results = {
    data: []
  };
  return fetch(`${config.url}/v1/statement`, {
    method: 'POST',
    body: query,
    headers: getHeaders(config)
  })
    .then(response => response.json())
    .then(statement => handleStatementAndGetMore(results, statement, config));
}
401035
def send_query(self, query):
        
        message = riemann_client.riemann_pb2.Msg()
        message.query.string = query
        return self.transport.send(message)
672350
def _do_query(self, query, iph, eth, in_port, msg):
        """"""
        datapath = msg.datapath
        dpid = datapath.id
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        # learn the querier.
        self._to_querier[dpid] = {
            'port': in_port,
            'ip': iph.src,
            'mac': eth.src
        }

        # set the timeout time.
        timeout = igmp.QUERY_RESPONSE_INTERVAL
        if query.maxresp:
            timeout = query.maxresp / 10

        self._to_hosts.setdefault(dpid, {})
        if query.address == '0.0.0.0':
            # general query. reset all reply status.
            for group in self._to_hosts[dpid].values():
                group['replied'] = False
                group['leave'] = None
        else:
            # specific query. reset the reply status of the specific
            # group.
            group = self._to_hosts[dpid].get(query.address)
            if group:
                group['replied'] = False
                group['leave'] = None

        actions = [parser.OFPActionOutput(ofproto.OFPP_FLOOD)]
        self._do_packet_out(
            datapath, msg.data, in_port, actions)

        # wait for REPORT messages.
        hub.spawn(self._do_timeout_for_query, timeout, datapath)
958642
def post(self, uri, body=None, **kwargs):
        """"""
        return self.fetch('post', uri, kwargs.pop("query", {}), body, **kwargs)
780927
def query(cls, owner=None, name=None, offset=None, limit=None, api=None):
        
        api = api if api else cls._API
        query_params = {}
        if owner:
            url = cls._URL['query'].format(owner=owner)
        else:
            url = cls._URL['query'].format(owner='')
        if name:
            query_params['name'] = name
        return super(Project, cls)._query(
            url=url, offset=offset, limit=limit, fields='_all',
            api=api, **query_params
        )
1173593
def query(options, collection_name, num_to_skip, num_to_return,
          query, field_selector, opts, check_keys=False, ctx=None):
    """"""
    if ctx:
        return _query_compressed(options, collection_name, num_to_skip,
                                 num_to_return, query, field_selector,
                                 opts, check_keys, ctx)
    return _query_uncompressed(options, collection_name, num_to_skip,
                               num_to_return, query, field_selector, opts,
                               check_keys)
563363
def query(query, args = {})
        args[:q] = query
        args[:qt] = 'standard'
        conn = ActiveFedora::SolrService.instance.conn
        result = conn.post('select', data: args)
        result.fetch('response').fetch('docs')
      end
258636
def query(self, query, interpolations=None):
        
        return self._client.ts_query(self, query, interpolations)
504236
def _send_query(self):
        
        timeout = 60
        ofproto = self._datapath.ofproto
        parser = self._datapath.ofproto_parser
        if ofproto_v1_0.OFP_VERSION == ofproto.OFP_VERSION:
            send_port = ofproto.OFPP_NONE
        else:
            send_port = ofproto.OFPP_ANY

        # create a general query.
        res_igmp = igmp.igmp(
            msgtype=igmp.IGMP_TYPE_QUERY,
            maxresp=igmp.QUERY_RESPONSE_INTERVAL * 10,
            csum=0,
            address='0.0.0.0')
        res_ipv4 = ipv4.ipv4(
            total_length=len(ipv4.ipv4()) + len(res_igmp),
            proto=inet.IPPROTO_IGMP, ttl=1,
            src='0.0.0.0',
            dst=igmp.MULTICAST_IP_ALL_HOST)
        res_ether = ethernet.ethernet(
            dst=igmp.MULTICAST_MAC_ALL_HOST,
            src=self._datapath.ports[ofproto.OFPP_LOCAL].hw_addr,
            ethertype=ether.ETH_TYPE_IP)
        res_pkt = packet.Packet()
        res_pkt.add_protocol(res_ether)
        res_pkt.add_protocol(res_ipv4)
        res_pkt.add_protocol(res_igmp)
        res_pkt.serialize()

        flood = [parser.OFPActionOutput(ofproto.OFPP_FLOOD)]

        while True:
            # reset reply status.
            for status in self._mcast.values():
                for port in status.keys():
                    status[port] = False

            # send a general query to the host that sent this message.
            self._do_packet_out(
                self._datapath, res_pkt.data, send_port, flood)
            hub.sleep(igmp.QUERY_RESPONSE_INTERVAL)

            # QUERY timeout expired.
            del_groups = []
            for group, status in self._mcast.items():
                del_ports = []
                actions = []
                for port in status.keys():
                    if not status[port]:
                        del_ports.append(port)
                    else:
                        actions.append(parser.OFPActionOutput(port))
                if len(actions) and len(del_ports):
                    self._set_flow_entry(
                        self._datapath, actions, self.server_port, group)
                if not len(actions):
                    self._del_flow_entry(
                        self._datapath, self.server_port, group)
                    del_groups.append(group)
                if len(del_ports):
                    for port in del_ports:
                        self._del_flow_entry(self._datapath, port, group)
                for port in del_ports:
                    del status[port]
            for group in del_groups:
                del self._mcast[group]

            rest_time = timeout - igmp.QUERY_RESPONSE_INTERVAL
            hub.sleep(rest_time)
592442
def _post_query(self, **query_dict):
        """"""
        param_dict = query_dict.copy()
        return self._send_query(do_post=True, **param_dict)
1314602
private void sendPipelineCheckMaster() throws IOException {
    if (urlParser.getHaMode() == HaMode.AURORA) {
      writer.startPacket(0);
      writer.write(COM_QUERY);
      writer.write(IS_MASTER_QUERY);
      writer.flush();
    }
  }
783437
def canonical_query
      query.map{|param,value| [AwsRequest.aws_encode(param), AwsRequest.aws_encode(value)]}.sort
    end
1312943
def bulk_query(self, query, *multiparams):
        """"""

        with self.get_connection() as conn:
            conn.bulk_query(query, *multiparams)
527178
def bulk_query(self, query, *multiparams):
        """"""

        self._conn.execute(text(query), *multiparams)
731284
def raw(self, query, settings=None, stream=False):
        '''
        
        '''
        query = self._substitute(query, None)
        return self._send(query, settings=settings, stream=stream).text