Format URL Constructs the request URL, optionally wraps the URL through a call to a proxy server Returns the formatted URL
551501
function formatUrl(p, callback) {

			// Are we signing the request?
			var sign;

			// OAuth1
			// Remove the token from the query before signing
			if (p.authResponse && p.authResponse.oauth && parseInt(p.authResponse.oauth.version, 10) === 1) {

				// OAUTH SIGNING PROXY
				sign = p.query.access_token;

				// Remove the access_token
				delete p.query.access_token;

				// Enfore use of Proxy
				p.proxy = true;
			}

			// POST body to querystring
			if (p.data && (p.method === 'get' || p.method === 'delete')) {
				// Attach the p.data to the querystring.
				_this.extend(p.query, p.data);
				p.data = null;
			}

			// Construct the path
			var path = _this.qs(p.url, p.query);

			// Proxy the request through a server
			// Used for signing OAuth1
			// And circumventing services without Access-Control Headers
			if (p.proxy) {
				// Use the proxy as a path
				path = _this.qs(p.oauth_proxy, {
					path: path,
					access_token: sign || '',

					// This will prompt the request to be signed as though it is OAuth1
					then: p.proxy_response_type || (p.method.toLowerCase() === 'get' ? 'redirect' : 'proxy'),
					method: p.method.toLowerCase(),
					suppress_response_codes: true
				});
			}

			callback(path);
		}
95751
def get(url, params={}, options={})
      FreebaseAPI.logger.debug("GET #{url}")
      params[:key] = @key if @key
      options = { format: options[:format], query: params }
      options.merge!(@proxy_options)
      response = self.class.get(url, options)
      handle_response(response)
    end
870705
function(url, params, formatFunction) {

		if (params) {

			// Set default formatting function
			formatFunction = formatFunction || encodeURIComponent;

			// Override the items in the URL which already exist
			for (var x in params) {
				var str = '([\\?\\&])' + x + '=[^\\&]*';
				var reg = new RegExp(str);
				if (url.match(reg)) {
					url = url.replace(reg, '$1' + x + '=' + formatFunction(params[x]));
					delete params[x];
				}
			}
		}

		if (!this.isEmpty(params)) {
			return url + (url.indexOf('?') > -1 ? '&' : '?') + this.param(params, formatFunction);
		}

		return url;
	}
516201
def __build_url(self, api_call, **kwargs):
        """"""
        kwargs['key'] = self.api_key
        if 'language' not in kwargs:
            kwargs['language'] = self.language
        if 'format' not in kwargs:
            kwargs['format'] = self.__format
        api_query = urlencode(kwargs)

        return "{0}{1}?{2}".format(urls.BASE_URL,
                                   api_call,
                                   api_query)
238552
def request_format
        format = request_params[:format]

        if format.nil? && context_scope.respond_to?(:request)
          request = context_scope.request
          format = request.format.to_sym.to_s if request.respond_to?(:format)
        end

        format = "json" unless format && respond_to?("to_#{format}")

        format
      end
616654
function getUrl (url) {
  var opt = {
    url: url
  , timeout: 10000 // 10 seconds
  }
  ;
  return new Promise(function(resolve, reject){
    request(opt, function(err, res, body){
      if (err) { return reject(err); }
      resolve(body)
    });
  });
}
473021
def _get(self, url,
             param_dict=None,
             securityHandler=None,
             additional_headers=None,
             handlers=None,
             proxy_url=None,
             proxy_port=None,
             compress=True,
             custom_handlers=None,
             out_folder=None,
             file_name=None):
        
        # ensure that no spaces are in the url
        url = url.replace(" ", "%20")

        pass_headers = {}
        if custom_handlers is None:
            custom_handlers = []
        if handlers is None:
            handlers = []
        if param_dict is None:
            param_dict = {}
        self._last_method = "GET"
        CHUNK = 4056
        param_dict, handler, cj = self._processHandler(securityHandler, param_dict)
        if additional_headers is not None:
            headers = [] + additional_headers
        else:
            headers = []
        pass_headers = {}
        if securityHandler and securityHandler.referer_url:
            pass_headers['referer'] = securityHandler.referer_url
        for h in headers:
            pass_headers[h[0]] = h[1]

        if compress:
            pass_headers['Accept-encoding'] = 'gzip'
        else:
            pass_headers['Accept-encoding'] = ""
        #headers.append(('User-Agent', USER_AGENT))
        pass_headers['User-Agent'] = self.useragent
        if len(param_dict.keys()) == 0:
            param_dict = None
        if handlers is None:
            handlers = []
        if handler is not None:
            handlers.append(handler)
        handlers.append(RedirectHandler())
        if self._verify == False and \
           sys.version_info[0:3] >= (2, 7, 9) and \
            hasattr(ssl,'create_default_context'):
            ctx = ssl.create_default_context()
            ctx.check_hostname = False
            ctx.verify_mode = ssl.CERT_NONE
            handlers.append(request.HTTPSHandler(context=ctx))
        if cj is not None:
            handlers.append(request.HTTPCookieProcessor(cj))
        if proxy_url is not None:
            if proxy_port is None:
                proxy_port = 80
            proxies = {"http":"http://%s:%s" % (proxy_url, proxy_port),
                       "https":"https://%s:%s" % (proxy_url, proxy_port)}
            proxy_support = request.ProxyHandler(proxies)
            handlers.append(proxy_support)
        opener = request.build_opener(*handlers)

        opener.addheaders = headers
        request.install_opener(opener)
        ctx = None
        hasContext = False
        if self._verify == False and \
           'context' in self._has_context(request.urlopen) and \
            sys.version_info[0:3] >= (2, 7, 9) and \
            hasattr(ssl,'create_default_context'):
            ctx = ssl.create_default_context()
            ctx.check_hostname = False
            ctx.verify_mode = ssl.CERT_NONE
            hasContext = True

        if hasContext == False:

            if param_dict is None:
                req = request.Request(self._asString(url),
                                      headers=pass_headers)
                resp = request.urlopen(req)
            elif len(str(urlencode(param_dict))) + len(url) >= 1999:
                return self._post(
                    url=url,
                    param_dict=param_dict,
                    files=None,
                    securityHandler=securityHandler,
                    additional_headers=additional_headers,
                    custom_handlers=custom_handlers,
                    proxy_url=proxy_url,
                    proxy_port=proxy_port,
                    compress=compress,
                    out_folder=out_folder,
                    file_name=file_name,
                    force_form_post=False)
            else:
                format_url = self._asString(url) + "?%s" % urlencode(param_dict)
                req = request.Request(format_url,
                                      headers=pass_headers)
                resp = request.urlopen(req)
        else:
            if param_dict is None:
                req = request.Request(self._asString(url),
                                      headers=pass_headers)
                resp = request.urlopen(req,
                                       context=ctx)
            elif len(str(urlencode(param_dict))) + len(url) >= 1999:
                return self._post(
                    url=url,
                    param_dict=param_dict,
                    files=None,
                    securityHandler=securityHandler,
                    additional_headers=additional_headers,
                    custom_handlers=custom_handlers,
                    proxy_url=proxy_url,
                    proxy_port=proxy_port,
                    compress=compress,
                    out_folder=out_folder,
                    file_name=file_name,
                    force_form_post=False)
            else:
                format_url = self._asString(url) + "?%s" % urlencode(param_dict)
                req = request.Request(format_url,
                                      headers=pass_headers)
                resp = request.urlopen(req,
                                       context=ctx)
        self._last_code = resp.getcode()
        self._last_url = resp.geturl()
        #  Get some headers from the response
        maintype = self._mainType(resp)
        contentDisposition = resp.headers.get('content-disposition')
        contentMD5 = resp.headers.get('Content-MD5')
        #contentEncoding = resp.headers.get('content-encoding')
        contentType = resp.headers.get('content-Type').split(';')[0].lower()
        contentLength = resp.headers.get('content-length')
        if maintype.lower() in ('image',
                                'application/x-zip-compressed') or \
           contentType in ('application/x-zip-compressed', 'application/octet-stream') or \
           contentMD5 is not None or\
           (contentDisposition is not None and \
            contentDisposition.lower().find('attachment;') > -1):

            fname = self._get_file_name(
                contentDisposition=contentDisposition,
                url=url)
            if out_folder is None:
                out_folder = tempfile.gettempdir()
            if contentLength is not None:
                max_length = int(contentLength)
                if max_length < CHUNK:
                    CHUNK = max_length
            file_name = os.path.join(out_folder, fname)
            with open(file_name, 'wb') as writer:
                for data in self._chunk(response=resp,
                                        size=CHUNK):
                    writer.write(data)
                    writer.flush()
                writer.flush()
                del writer
            return file_name
        else:
            read = ""
            for data in self._chunk(response=resp,
                                    size=CHUNK):
                if self.PY3 == True:
                    read += data.decode('utf-8')
                else:
                    read += data

                del data
            try:
                results = json.loads(read)
                if 'error' in results:
                    if 'message' in results['error']:
                        if results['error']['message'] == 'Request not made over ssl':
                            if url.startswith('http://'):
                                url = url.replace('http://', 'https://')
                                return self._get(url,
                                                 param_dict,
                                                 securityHandler,
                                                 additional_headers,
                                                 handlers,
                                                 proxy_url,
                                                 proxy_port,
                                                 compress,
                                                 custom_handlers,
                                                 out_folder,
                                                 file_name)
                return results
            except:
                return read
351868
def generate_url(scheme=None, host=None, port=None, path=None, query=None):
    
    url = ""
    if scheme is not None:
        url += "%s://" % scheme
    if host is not None:
        url += host
    if port is not None:
        url += ":%s" % str(port)
    if path is not None:
        url += ensure_url_path_starts_with_slash(path)
    if query is not None:
        url += "?%s" % (urlencode(query))
    return url
450186
public Object getRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException {
		HttpURLConnection conn = null;
		try {
			// Make the URL
			urlString = new StringBuilder(this.host).append(restUrl);
			urlString.append(this.makeParamsString(params, true));
		    LOGGER.debug("Doing HTTP request: GET [{}]", urlString.toString());
			// Connection configuration
//            Proxy proxy = DEBUG_HTTP ? new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8008)) : Proxy.NO_PROXY;			
            URL url = new URL(urlString.toString());
			conn = (HttpURLConnection) url.openConnection();
			conn.setRequestMethod(HttpMethod.GET.name());
			conn.setRequestProperty("Connection", "Keep-Alive");

			// Gets the response
			return this.readResponse(restUrl, conn);
        } catch (WebServiceException e) {
            LOGGER.debug("WebServiceException catched. Request error", e);
            throw e;
		} catch (IOException e) {
            LOGGER.debug("IOException catched. Request error", e);
			throw e;
		} catch (Exception e) {
            LOGGER.debug("Exception catched, throwing a new IOException. Request error", e);
            throw new IOException(e.getLocalizedMessage());
		} finally {
			if (conn != null) {
				conn.disconnect();
			}
		}
	}
380887
def get_url(self, **kwargs):
        

        return build(
            self._request.path,
            self._request.GET,
            self._meta.prefix,
            **kwargs )
1351371
function buildUrl(urlPattern, customParams) {
    var url = formatUrl.apply(null, urlPattern);

    url = appendParams(url, customParams);
    return url;
  }
455253
def _build_request_url(self, secure, api_method, version):
        
        if secure:
            proto = ANDROID.PROTOCOL_SECURE
        else:
            proto = ANDROID.PROTOCOL_INSECURE
        req_url = ANDROID.API_URL.format(
            protocol=proto,
            api_method=api_method,
            version=version
        )
        return req_url
504852
def _build_url(self, endpoint):
        
        server = None
        if "://" in endpoint:
            # looks like an url, let's break it down
            server, endpoint = self._deconstruct_url(endpoint)

        endpoint = endpoint.lstrip("/")
        url = "{proto}://{server}/{endpoint}".format(
            proto=self.protocol,
            server=self.client.server if server is None else server,
            endpoint=endpoint,
        )
        return url
803808
def format_url(self, url, **kwargs):
        # type: (str, Any) -> str
        
        url = url.format(**kwargs)
        parsed = urlparse(url)
        if not parsed.scheme or not parsed.netloc:
            url = url.lstrip('/')
            base = self.config.base_url.format(**kwargs).rstrip('/')
            url = urljoin(base + '/', url)
        return url
941453
def _build_url(self, query_params):
        
        url = ''
        count = 0
        while count < len(self._url_path):
            url += '/{}'.format(self._url_path[count])
            count += 1

        # add slash
        if self.append_slash:
            url += '/'

        if query_params:
            url_values = urlencode(sorted(query_params.items()), True)
            url = '{}?{}'.format(url, url_values)

        if self._version:
            url = self._build_versioned_url(url)
        else:
            url = '{}{}'.format(self.host, url)
        return url
1022167
def _format(self):
        
        self.log.debug("Formatting URLs to request")
        items = list()
        for i in range(0, self.limit, 10):
            query = '"%s" %s' % (self.domain, self.modifier)
            url = self.host + "/search?q=" + query + "&first=" + str(i)
            items.append(url)
        self.log.debug("URLs were generated")
        return items
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)