Build the url with the appended request if provided.
761252
def url(self, request=""):
        """"""
        if request.startswith("/"):
            request = request[1:]
        return "{}://{}/{}".format(self.scheme, self.host, request)
327828
def _add_url_rule(url_or_urls):
    """"""
    old = current_app._got_first_request
    # This is bit of cheating to overcome @flask.app.setupmethod decorator.
    current_app._got_first_request = False
    if isinstance(url_or_urls, six.string_types):
        url_or_urls = [url_or_urls]
    map(lambda url: current_app.add_url_rule(url, 'invenio_pages.view', view),
        url_or_urls)
    current_app._got_first_request = old
830798
def build_url(self):
        """"""

        if not self.api_filters:
            return self.url

        # Reduce complex objects to simpler strings
        for k, v in self.api_filters.items():
            if isinstance(v, datetime):  # datetime > UNIX timestamp
                self.api_filters[k] = int(calendar.timegm(v.timetuple()))
            if isinstance(v, (tuple, list)):  # tuples & lists > x,y,z
                self.api_filters[k] = ",".join([str(_) for _ in v])

        if (
            self.id_filter in self.api_filters and
            len(str(self.api_filters[self.id_filter])) > self.URL_LENGTH_LIMIT
        ):
            self.build_url_chunks()
            return self.split_urls.pop(0)

        filters = '&'.join("%s=%s" % (k, v) for (k, v) in self.api_filters.items())

        return "%s?%s" % (self.url, filters)
656284
private function buildRequestUrl()
    {
        if (!empty($_SERVER['REQUEST_URI'])) {
            return sprintf(
                '%s://%s%s%s',
                $this->guessProtocol(),
                $this->guessHost(),
                $this->guessPort(),
                $_SERVER['REQUEST_URI']
            );
        }
    }
468897
def request_run():
    """"""
    build = g.build
    current_release, current_run = _get_or_create_run(build)

    current_url = request.form.get('url', type=str)
    config_data = request.form.get('config', default='{}', type=str)
    utils.jsonify_assert(current_url, 'url to capture required')
    utils.jsonify_assert(config_data, 'config document required')

    config_artifact = _enqueue_capture(
        build, current_release, current_run, current_url, config_data)

    ref_url = request.form.get('ref_url', type=str)
    ref_config_data = request.form.get('ref_config', type=str)
    utils.jsonify_assert(
        bool(ref_url) == bool(ref_config_data),
        'ref_url and ref_config must both be specified or not specified')

    if ref_url and ref_config_data:
        ref_config_artifact = _enqueue_capture(
            build, current_release, current_run, ref_url, ref_config_data,
            baseline=True)
    else:
        _, last_good_run = _find_last_good_run(build)
        if last_good_run:
            current_run.ref_url = last_good_run.url
            current_run.ref_image = last_good_run.image
            current_run.ref_log = last_good_run.log
            current_run.ref_config = last_good_run.config

    db.session.add(current_run)
    db.session.commit()

    signals.run_updated_via_api.send(
        app, build=build, release=current_release, run=current_run)

    return flask.jsonify(
        success=True,
        build_id=build.id,
        release_name=current_release.name,
        release_number=current_release.number,
        run_name=current_run.name,
        url=current_run.url,
        config=current_run.config,
        ref_url=current_run.ref_url,
        ref_config=current_run.ref_config)
203076
def _append_params_to_uri(cls, uri, params):
        

        if params:
            return uri + cls._DELIMITER_URL_QUERY + urlencode(params)

        return uri
622524
def prepend_urls(self):
        
        return [
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/generate%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('generate'), name="api_tileset_generate"),
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/download%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('download'), name="api_tileset_download"),
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/status%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('status'), name="api_tileset_status"),
            url(r"^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/stop%s$" %
                (self._meta.resource_name, trailing_slash()),
                self.wrap_view('stop'), name="api_tileset_stop"),
        ]
1301405
def _CreateRequest(self, url, data=None):
		""""""
		logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
		req = urllib2.Request(url, data=data)
		if self.host_override:
			req.add_header("Host", self.host_override)
		for key, value in self.extra_headers.iteritems():
			req.add_header(key, value)
		return req
972443
def _build_url(self):
        """"""
        if self.connection.get("username") and self.connection.get("password"):
            auth = "%s:%s@" % (self.connection["username"],
                               self._encoded_password)
            if self.connection.get("domain"):
                auth = r"%s;%s" % (self.connection["domain"], auth)
        else:
            auth = ""

        # Optional port number
        port = self.connection.get("port")
        port = ":" + port if port else ""

        # Construct mount_url
        self.connection["mount_url"] = "//%s%s%s/%s" % (
            auth, self.connection["url"], port, self.connection["share_name"])
575353
def action_add_url(self):
        """"""
        if not self.env.context.get('active_model'):
            return
        attachment_obj = self.env['ir.attachment']
        for form in self:
            url = parse.urlparse(form.url)
            if not url.scheme:
                url = parse.urlparse('%s%s' % ('http://', form.url))
            for active_id in self.env.context.get('active_ids', []):
                attachment = {
                    'name': form.name,
                    'type': 'url',
                    'url': url.geturl(),
                    'res_id': active_id,
                    'res_model': self.env.context['active_model'],
                }
                attachment_obj.create(attachment)
        return {'type': 'ir.actions.act_close_wizard_and_reload_view'}
924973
def _try_url_with_appended_slash(self):
        
        new_url_to_try = self.kwargs.get('path', '') + '/'
        if not new_url_to_try.startswith('/'):
            new_url_to_try = '/' + new_url_to_try
        if CMSPage.objects.published().filter(url=new_url_to_try).exists():
            return HttpResponsePermanentRedirect(new_url_to_try)
        else:
            raise Http404
755474
def construct_url(self):
        """"""
        path = [self.path]
        path.extend([str(x) for x in self.params])

        url = self.client.base_url + '/'.join(x for x in path if x)
        query = self.kwargs.get('query')

        if query:
            # Dict -> List
            if type(query) is dict:
                query = query.items()

            # Remove items with `None` value
            query = [
                (k, v) for (k, v) in query
                if v is not None
            ]

            # Encode query, append to URL
            url += '?' + urlencode(query)

        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)
433277
def _post_request(self, url, data=None, json=None, **kwargs):
        
        '''  '''
        
    # construct request kwargs
        request_kwargs = {
            'method': 'POST',
            'url': url,
            'data': data,
            'json': json
        }
        for key, value in kwargs.items():
            request_kwargs[key] = value

    # send request and handle response
        return self._request(**request_kwargs)
942975
protected AppendResponse handleAppend(AppendRequest request) {
    // If the request term is less than the current term then immediately
    // reply false and return our current term. The leader will receive
    // the updated term and step down.
    if (request.term() < context.getTerm()) {
      LOGGER.debug("{} - Rejected {}: request term is less than the current term ({})", context.getCluster().member().address(), request, context.getTerm());
      return AppendResponse.builder()
        .withStatus(Response.Status.OK)
        .withTerm(context.getTerm())
        .withSucceeded(false)
        .withLogIndex(context.getLog().lastIndex())
        .build();
    } else {
      return checkGlobalIndex(request);
    }
  }
21736
protected String buildUrl(Request request)
    {
        StringBuilder sb = new StringBuilder(512);
        sb.append(baseUrl).append(request.getEntityName()).append("/");
        if(request.getPath() != null)
            sb.append(request.getPath());

        String queryString = buildQueryString(request);
        if(queryString.length()>0)
        {
            sb.append("?").append(queryString);
        }

        return sb.toString();
    }
767110
def _build_url(self, shorten=True):
        """"""
        self.url = URL_FORMAT.format(*self._get_url_params(shorten=shorten))