Return encoded query params to be used in proxied request
516889
def get_encoded_query_params(self):
        """"""
        get_data = encode_items(self.request.GET.lists())
        return urlencode(get_data)
975672
def get_canonical_query_params(self):
        """"""
        result = []
        for key, value in self.sorted_params():
            result.append("%s=%s" % (self.encode(key), self.encode(value)))
        return "&".join(result)
795685
function encodeQueryMap(map) {
  var params = [];
  for (var key in map) {
    var value = map[key];
    params.push(key + '=' + urlEncode_(value));
  }
  return params.join('&');
}
330165
def parse_uri_query_params(query)
      query.to_s.split('&'.freeze).reduce({}) do |h, p|
        k, v = p.split('='.freeze, 2)
        v = URI::Generic::DEFAULT_PARSER.unescape(v) if v
        h[k.to_sym] = v || true
        h
      end
    end
804771
def get_proxies():
    """"""
    proxies = getproxies()
    filtered_proxies = {}
    for key, value in proxies.items():
        if key.startswith('http://'):
            if not value.startswith('http://'):
                filtered_proxies[key] = 'http://{0}'.format(value)
            else:
                filtered_proxies[key] = value
    return filtered_proxies
350181
def _get_query_params(query):
    
    query_params = OrderedDict(sorted(query['query'].items()))
    return ' '.join(['{}={}'.format(k, v) for k, v in query_params.items()])
1263513
def _long_query_encoded(self):
        
        uristr = self._encode(omit_keys=True)
        kstr = "{}"

        klist = self._real_options.get('keys', UNSPEC)
        if klist != UNSPEC:
            kstr = '{{"keys":{0}}}'.format(klist)

        return (uristr, kstr)
960912
function getQueryParams(params) {
        params = params || {};
        var url = $location.url();
        var idx = url.indexOf('?');

        // if there is a query string
        if (idx < 0) { return {}; }

        // get the query string and split the keyvals
        var query = url.substring(idx + 1);
        var keyVals = query.split('&');

        // put each key/val into the params object
        _.each(keyVals, function (keyVal) {
            var keyValArr = keyVal.split('=');
            params[keyValArr[0]] = keyValArr[1];
        });

        return params;
    }
857026
def queryProxy(self, query):
        """"""
        # Query is a QNetworkProxyQuery
        valid_proxies = []

        query_scheme = query.url().scheme()
        query_host = query.url().host()
        query_scheme_host = '{0}://{1}'.format(query_scheme, query_host)
        proxy_servers = process_proxy_servers(self.proxy_servers)
#        print(proxy_servers)

        if proxy_servers:
            for key in proxy_servers:
                proxy_settings = proxy_servers[key]

                if key == 'http' and query_scheme == 'http':
                    proxy = self._create_proxy(proxy_settings)
                    valid_proxies.append(proxy)
                elif key == 'https' and query_scheme == 'https':
                    proxy = self._create_proxy(proxy_settings)
                    valid_proxies.append(proxy)

                if key == query_scheme_host:
                    proxy = self._create_proxy(proxy_settings)
                    valid_proxies.append(proxy)
        else:
            valid_proxies.append(QNetworkProxy(QNetworkProxy.DefaultProxy))

#        print('factoy', query.url().toString())
#        print(valid_proxies)
#        for pr in valid_proxies:
#            user = pr.user()
#            password = pr.password()
#            host = pr.hostName()
#            port = pr.port()
#            print(query.url(), user, password, host, port)
#        print('\n')
        return valid_proxies
1154678
def _build_query(self, uri, params=None, action_token_type=None):
        """"""

        if params is None:
            params = QueryParams()

        params['response_format'] = 'json'

        session_token = None

        if action_token_type in self._action_tokens:
            # Favor action token
            using_action_token = True
            session_token = self._action_tokens[action_token_type]
        else:
            using_action_token = False
            if self._session:
                session_token = self._session['session_token']

        if session_token:
            params['session_token'] = session_token

        # make order of parameters predictable for testing
        keys = list(params.keys())
        keys.sort()

        query = urlencode([tuple([key, params[key]]) for key in keys])

        if not using_action_token and self._session:
            secret_key_mod = int(self._session['secret_key']) % 256

            signature_base = (str(secret_key_mod) +
                              self._session['time'] +
                              uri + '?' + query).encode('ascii')

            query += '&signature=' + hashlib.md5(signature_base).hexdigest()

        return query
69798
function encodeQueryData(obj, prefix) {
          var str = [];
          for (var p in obj) {
            if (obj.hasOwnProperty(p)) {
              var k = prefix ? prefix + '[' + p + ']' : p, v = obj[p];
              str.push(typeof v === 'object' ? encodeQueryData(v, k) : encodeURIComponent(k) + '=' + encodeURIComponent(v));
            }
          }
          return str.join('&');
        }
20168
def prepare_params(request):
    """"""
    return request.replace(
        params={key: dump_param(val) for key, val in request.params.items()
                if val is not None})
1014997
def _encode_query(query):
    """"""
    if query == '':
        return query
    query_args = []
    for query_kv in query.split('&'):
        k, v = query_kv.split('=')
        query_args.append(k + "=" + quote(v.encode('utf-8')))
    return '&'.join(query_args)
838349
def to_api_repr(self):
        
        resource = copy.deepcopy(self._properties)

        # Query parameters have an addition property associated with them
        # to indicate if the query is using named or positional parameters.
        query_parameters = resource["query"].get("queryParameters")
        if query_parameters:
            if query_parameters[0].get("name") is None:
                resource["query"]["parameterMode"] = "POSITIONAL"
            else:
                resource["query"]["parameterMode"] = "NAMED"

        return resource
987841
def encode_http_params(**kw):
    '''
    
    '''
    try:
        _fo = lambda k, v: '{name}={value}'.format(
            name=k, value=to_basestring(quote(v)))
    except:
        _fo = lambda k, v: '%s=%s' % (k, to_basestring(quote(v)))

    _en = utf8

    return '&'.join([_fo(k, _en(v)) for k, v in kw.items() if not is_empty(v)])
951396
function encodeParams(params) {
    var queryString;
    if (params && Object.keys(params)) {
        queryString = [].slice.call(arguments).reduce(function (a, b) {
            return a.concat(b instanceof Array ? b : [b]);
        }, []).filter(function (c) {
            return "object" === typeof c;
        }).reduce(function (p, c) {
            !(c instanceof Array) ? p = p.concat(Object.keys(c).map(function (key) {
                return [key, c[key]];
            })) : p.push(c);
            return p;
        }, []).reduce(function (p, c) {
            c.length === 2 ? p.push(c) : p = p.concat(c);
            return p;
        }, []).reduce(function (p, c) {
            c[1] instanceof Array ? c[1].forEach(function (v) {
                p.push([c[0], v]);
            }) : p.push(c);
            return p;
        }, []).map(function (c) {
            c[1] = encodeURIComponent(c[1]);
            return c.join("=");
        }).join("&");
    }
    return queryString;
}
1155084
function coerceQueryParamsToString(queryParams) {
    for (var key in queryParams) {
      if (typeof queryParams[key] === 'number') {
        queryParams[key] = '' + queryParams[key];
      } else if (isArray(queryParams[key])) {
        for (var i = 0, l = queryParams[key].length; i < l; i++) {
          queryParams[key][i] = '' + queryParams[key][i];
        }
      }
    }
  }