Query the Overpass API

        :param String|Bytes query: The query string in Overpass QL
        :return: The parsed result
        :rtype: overpy.Result
6796
def query(self, query):
        
        if not isinstance(query, bytes):
            query = query.encode("utf-8")

        retry_num = 0
        retry_exceptions = []
        do_retry = True if self.max_retry_count > 0 else False
        while retry_num <= self.max_retry_count:
            if retry_num > 0:
                time.sleep(self.retry_timeout)
            retry_num += 1
            try:
                f = urlopen(self.url, query)
            except HTTPError as e:
                f = e

            response = f.read(self.read_chunk_size)
            while True:
                data = f.read(self.read_chunk_size)
                if len(data) == 0:
                    break
                response = response + data
            f.close()

            if f.code == 200:
                if PY2:
                    http_info = f.info()
                    content_type = http_info.getheader("content-type")
                else:
                    content_type = f.getheader("Content-Type")

                if content_type == "application/json":
                    return self.parse_json(response)

                if content_type == "application/osm3s+xml":
                    return self.parse_xml(response)

                e = exception.OverpassUnknownContentType(content_type)
                if not do_retry:
                    raise e
                retry_exceptions.append(e)
                continue

            if f.code == 400:
                msgs = []
                for msg in self._regex_extract_error_msg.finditer(response):
                    tmp = self._regex_remove_tag.sub(b"", msg.group("msg"))
                    try:
                        tmp = tmp.decode("utf-8")
                    except UnicodeDecodeError:
                        tmp = repr(tmp)
                    msgs.append(tmp)

                e = exception.OverpassBadRequest(
                    query,
                    msgs=msgs
                )
                if not do_retry:
                    raise e
                retry_exceptions.append(e)
                continue

            if f.code == 429:
                e = exception.OverpassTooManyRequests
                if not do_retry:
                    raise e
                retry_exceptions.append(e)
                continue

            if f.code == 504:
                e = exception.OverpassGatewayTimeout
                if not do_retry:
                    raise e
                retry_exceptions.append(e)
                continue

            e = exception.OverpassUnknownHTTPStatusCode(f.code)
            if not do_retry:
                raise e
            retry_exceptions.append(e)
            continue

        raise exception.MaxRetriesReached(retry_count=retry_num, exceptions=retry_exceptions)
1043147
def query(
        self, queryEngine, query_str, vendorSpecific=None, do_post=False, **kwargs
    ):
        
        response = self.queryResponse(
            queryEngine, query_str, vendorSpecific, do_post, **kwargs
        )
        if self._content_type_is_json(response):
            return self._read_json_response(response)
        else:
            return self._read_stream_response(response)
1244909
def query(query_str)
      # puts "conent #{content}"
      res = conn.post '/query/', {query: query_str, time: Time.now.to_i}.to_json do |req|
        req.headers['Content-Type'] = 'application/json'
        req.headers['X-Requested-With'] = 'XMLHttpRequest'
        req['Cookie'] = "csrftoken=#{csrf_token}"
        req.headers['X-CSRFToken'] = csrf_token
      end
      JSON.parse(res.body)
   end
837117
def query(self):
        
        ret = MultiDict(parse_qsl(self.raw_query_string, keep_blank_values=True))
        return MultiDictProxy(ret)
909086
def query(self, query):
        
        if isinstance(self.transport, riemann_client.transport.UDPTransport):
            raise Exception('Cannot query the Riemann server over UDP')
        response = self.send_query(query)
        return [self.create_dict(e) for e in response.events]
1110955
def get_value(self, query):
        
        indices = self.get_dimension_indices(query)
        index = self.get_value_index(indices)
        value = self.get_value_by_index(index)
        return value
273929
def query(self):
        
        tree = pypeg2.parse(self._query, parser(), whitespace="")
        for walker in query_walkers():
            tree = tree.accept(walker)
        return tree
1249926
def _send_query(self, query: Dict[str, Any]):
        
        queryb = self.encoder(query)
        self._client.write(queryb)
        if self.debug is True:
            print("send query {}".format(queryb))

        return True
558834
def query_string(context, **kwargs):
    """"""
    params = context["request"].GET.copy()

    for key, value in list(kwargs.items()):
        params[key] = value

    return "?" + params.urlencode()
945936
def parse(cls, query_str):
		
		parsed_query = parse_qs(query_str, keep_blank_values=True, strict_parsing=True)
		result = cls()
		for parameter_name in parsed_query.keys():
			for parameter_value in parsed_query[parameter_name]:
				result.add_parameter(
					parameter_name,
					parameter_value if len(parameter_value) > 0 else None
				)
		return result
1059856
def query(self, query, fetchall=False, **params):
        
        with self.get_connection() as conn:
            return conn.query(query, fetchall, **params)
391627
def Query(self, query, parameters=None):
    
    # TODO: catch Warning and return None.
    # Note that we cannot pass parameters as a keyword argument here.
    # A parameters value of None is not supported.
    if parameters:
      self._cursor.execute(query, parameters)
    else:
      self._cursor.execute(query)

    return self._cursor.fetchall()
857599
def stringify_query(query):
        

        if isinstance(query, QueryBuilder):
            # Get string-representation of the passed :class:`pysnow.QueryBuilder` object
            return str(query)
        elif isinstance(query, dict):
            # Dict-type query
            return '^'.join(['%s=%s' % (k, v) for k, v in six.iteritems(query)])
        elif isinstance(query, six.string_types):
            # Regular string-type query
            return query
        else:
            raise InvalidUsage('Query must be of type string, dict or a QueryBuilder object')
1325728
def query(cls, file, offset=None, limit=None, api=None):
        
        api = api if api else cls._API

        file = Transform.to_file(file)
        return super(Marker, cls)._query(
            url=cls._URL['query'], offset=offset, limit=limit,
            file=file, fields='_all', api=api
        )
523195
def _query(self, text):
        
        params = (
            ('v', self.api_version),
            ('query', text),
            ('lang', self.language),
            ('sessionId', self.session_id),
            ('timezone', self.timezone),
        )
        # store query_response if required
        if self.query_response:
            self.previous_query_response = self.query_response

        self.query_response = result = self.session.get(url=self.query_url, params=params).json()

        return result
1305389
def _parse_asn_query(self, query_str):
        
        # find query parts
        query_str_parts = self._get_query_parts(query_str)

        # go through parts and add to query_parts list
        query_parts = list()
        for query_str_part in query_str_parts:

            is_int = True
            try:
                int(query_str_part['string'])
            except ValueError:
                is_int = False

            if is_int:
                self._logger.debug("Query part '" + query_str_part['string'] + "' interpreted as integer (ASN)")
                query_parts.append({
                    'interpretation': {
                        'string': query_str_part['string'],
                        'interpretation': 'asn',
                        'attribute': 'asn',
                        'operator': 'equals',
                    },
                    'operator': 'equals',
                    'val1': 'asn',
                    'val2': query_str_part['string']
                })

            else:
                self._logger.debug("Query part '" + query_str_part['string'] + "' interpreted as text")
                query_parts.append({
                    'interpretation': {
                        'string': query_str_part['string'],
                        'interpretation': 'text',
                        'attribute': 'name',
                        'operator': 'regex',
                    },
                    'operator': 'regex_match',
                    'val1': 'name',
                    'val2': query_str_part['string']
                })

        # Sum all query parts to one query
        query = {}
        if len(query_parts) > 0:
            query = query_parts[0]

        if len(query_parts) > 1:
            for query_part in query_parts[1:]:
                query = {
                    'interpretation': {
                        'interpretation': 'and',
                        'operator': 'and',
                    },
                    'operator': 'and',
                    'val1': query_part,
                    'val2': query
                }

        return True, query
229473
def get_payload(self):
        
        temp = self.get_uri_as_list()
        query_string = temp[4]
        if query_string == "":
            return None  # Bad request error code
        query_string_as_list = str.split(query_string, "=")
        return query_string_as_list[1]