Get query parameter uniformly for GET and POST requests.
777464
def get_query_param(request, key):
    """"""
    value = request.query_params.get(key) or request.data.get(key)
    if value is None:
        raise KeyError()
    return value
372781
def parse_querystring(self, req, name, field):
        """"""
        return core.get_value(req.args, name, field)
465892
def _query_param_from_api_repr(resource):
    """"""
    qp_type = resource["parameterType"]
    if "arrayType" in qp_type:
        klass = ArrayQueryParameter
    elif "structTypes" in qp_type:
        klass = StructQueryParameter
    else:
        klass = ScalarQueryParameter
    return klass.from_api_repr(resource)
1261650
function get(req, res, next) {
  var params = {
    _id: req.params.id
  };

  logger.debug("Middleware Submissions Get ", {params: params});

  forms.getSubmission(req.connectionOptions, params, submissionsHandler(constants.resultTypes.submissions, req, next));
}
292580
function GET(uri, params) {
	const reqUrl = `${uri}${url.format({ query: params })}`;

	log(`request URL: ${reqUrl}`);

	return fetch(reqUrl)
		.then(function handleGetRequest(res) {
			const status = res.status;
			const statusText = res.statusText;

			log(`status code: ${status}`);
			log(`status text: ${statusText}`);

			if (status !== 200) {
				const err = new Error(`Request failed: ${statusText}`);

				err.status = status;

				throw err;
			}

			return res.json();
		})
		.then(data => {
			const posts = data.posts;

			log(`${posts.length} posts were fetched`);

			return posts;
		})
		.catch(err => {
			log('catched err: ', err);

			throw err;
		});
}
1222328
def get(self, query, *parameters, **kwargs):
        """"""
        rows = self.query(query, *parameters, **kwargs)
        if not rows:
            return None
        elif len(rows) > 1:
            raise ValueError('Multiple rows returned for get() query')
        else:
            return rows[0]
182746
def check_request_parameters(self, parameters: dict = dict):
        
        # -- SEMANTIC QUERY ---------------------------------------------------
        li_args = parameters.get("q").split()
        logging.debug(li_args)

        # Unicity
        li_filters = [i.split(":")[0] for i in li_args]
        filters_count = Counter(li_filters)
        li_filters_must_be_unique = ("coordinate-system", "format", "owner", "type")
        for i in filters_count:
            if i in li_filters_must_be_unique and filters_count.get(i) > 1:
                raise ValueError(
                    "This query filter must be unique: {}"
                    " and it occured {} times.".format(i, filters_count.get(i))
                )

        # dict
        dico_query = FILTER_KEYS.copy()
        for i in li_args:
            if i.startswith("action"):
                dico_query["action"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("catalog"):
                dico_query["catalog"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("contact") and i.split(":")[1] == "group":
                dico_query["contact:group"].append(i.split(":")[1:][1])
                continue
            elif i.startswith("contact"):
                dico_query["contact:isogeo"].append(i.split(":", 1)[1])
                continue
            elif i.startswith("coordinate-system"):
                dico_query["coordinate-system"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("data-source"):
                dico_query["data-source"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("format"):
                dico_query["format"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("has-no"):
                dico_query["has-no"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("keyword:isogeo"):
                dico_query["keyword:isogeo"].append(i.split(":")[1:][1])
                continue
            elif i.startswith("keyword:inspire-theme"):
                dico_query["keyword:inspire-theme"].append(i.split(":")[1:][1])
                continue
            elif i.startswith("license:isogeo"):
                dico_query["license:isogeo"].append(i.split(":")[1:][1:])
                continue
            elif i.startswith("license"):
                dico_query["license:group"].append(i.split(":", 1)[1:][0:])
                continue
            elif i.startswith("owner"):
                dico_query["owner"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("provider"):
                dico_query["provider"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("share"):
                dico_query["share"].append(i.split(":")[1:][0])
                continue
            elif i.startswith("type"):
                dico_query["type"].append(i.split(":")[1:][0])
                continue
            else:
                # logging.debug(i.split(":")[1], i.split(":")[1].isdigit())
                dico_query["text"].append(i)
                continue

        # Values
        dico_filters = {i.split(":")[0]: i.split(":")[1:] for i in li_args}
        if dico_filters.get("type", ("dataset",))[0].lower() not in FILTER_TYPES:
            raise ValueError(
                "type value must be one of: {}".format(" | ".join(FILTER_TYPES))
            )
        elif dico_filters.get("action", ("download",))[0].lower() not in FILTER_ACTIONS:
            raise ValueError(
                "action value must be one of: {}".format(" | ".join(FILTER_ACTIONS))
            )
        elif (
            dico_filters.get("provider", ("manual",))[0].lower() not in FILTER_PROVIDERS
        ):
            raise ValueError(
                "provider value must be one of: {}".format(" | ".join(FILTER_PROVIDERS))
            )
        else:
            logging.debug(dico_filters)

        # -- GEOGRAPHIC -------------------------------------------------------
        in_box = parameters.get("box")
        in_geo = parameters.get("geo")
        # geometric relation
        in_rel = parameters.get("rel")
        if in_rel and in_box is None and in_geo is None:
            raise ValueError("'rel' should'nt be used without box or geo.")
        elif in_rel not in GEORELATIONS and in_rel is not None:
            raise ValueError(
                "{} is not a correct value for 'georel'."
                " Must be one of: {}.".format(in_rel, " | ".join(GEORELATIONS))
            )
77327
def parse_querystring(self, req, name, field):
        """"""
        return core.get_value(req.params, name, field)
258304
def get_query_params(self):
        """"""
        params = self.request.query_params.copy()
        params.update(self.request.data)
        return params
699889
def query(self):
        """"""
        self._query = query = ""

        query_kwargs = self.query_kwargs
        if query_kwargs: query = urlencode(query_kwargs, doseq=True)
        return query
951745
def request(self, url, method="get", format="json", data=None,
                expected_status=None, headers=None, use_xpost=True, **options):
        
        if expected_status is None:
            if method == "get":
                expected_status = 200
            elif method == "post":
                expected_status = 201
            else:
                raise ValueError("No expected status supplied and method unknown.")

        if not url.startswith("http"):
            url = "{self.host}/api/v4/{url}".format(**locals())
        if format is not None:
            options = dict({'format': format}, **options)
        options = {field: value for field, value in options.items() if value is not None}
        headers = dict(headers or {}, Authorization="Token {}".format(self.token))
        #headers['Accept-encoding'] = 'gzip'

        if method == "get" and use_xpost:
            # If method is purely GET, we can use X-HTTP-METHOD-OVERRIDE to send our
            # query via POST. This allows for a large number of parameters to be supplied
            assert(data is None)

            headers.update({"X-HTTP-METHOD-OVERRIDE": method})
            data = options
            options = None
            method = "post"

        r = requests.request(method, url, data=data, params=options, headers=headers)

        log.debug(
            "HTTP {method} {url} (options={options!r}, data={data!r},"
            "headers={headers}) -> {r.status_code}".format(**locals())
        )
        return check(r, expected_status=expected_status)
389174
def _request(self, uri, params=None, postParams=None, verb='GET'):
        """"""
        return getattr(requests, verb.lower())(self.url + uri, params=params, data=postParams, stream=True)
314434
def do_GET(self):
    """"""
    if not self._client_allowed():
      return

    try:
      (_, _, path, query, _) = urlsplit(self.path)
      params = parse_qs(query)
      # Give each handler a chance to respond.
      for prefix, handler in self._GET_handlers:
        if self._maybe_handle(prefix, handler, path, params):
          return
      # If no path specified, default to showing the list of all runs.
      if path == '/':
        self._handle_runs('', {})
        return

      content = 'Invalid GET request {}'.format(self.path).encode('utf-8'),
      self._send_content(content, 'text/html', code=400)
    except (IOError, ValueError):
      pass
198699
function get($path, $query = null, $headers = null, $curlOpts = null) {
        $payload = $this -> encodePostBody($query);
        
        if ($payload !== "") {
            if (strpos($path, '?')) {
                $url = $path . "&" . $payload;
            } else {
                $url = $path . "?" . $payload;
            }
        }else{
            $url = $path;
        }
        
        return $this -> request($url, self::HTTP_GET, '', $headers, $curlOpts);
    }
1072785
def get(self, *args, **kwargs):
        

        self._parameters.query = kwargs.pop('query', {}) if len(args) == 0 else args[0]
        self._parameters.limit = kwargs.pop('limit', 10000)
        self._parameters.offset = kwargs.pop('offset', 0)
        self._parameters.fields = kwargs.pop('fields', kwargs.pop('fields', []))

        return self._get_response('GET', stream=kwargs.pop('stream', False))
929551
def _get(self, url, params=None, headers=None):
        """"""
        url = self.clean_url(url)
        response = requests.get(url, params=params, verify=self.verify,
                                timeout=self.timeout, headers=headers)
        return response
256443
def get(url, parameters = {}, skip_status_check = false)
      response = connection.get("#{api_endpoint}#{url}", parameters)
      on_complete(response) unless skip_status_check
      response
    end