Post the given link check result to the client site.
763096
def upsert_result(client_site_url, apikey, resource_id, result):
    """"""

    # TODO: Handle exceptions and unexpected results.
    url = client_site_url + u"deadoralive/upsert"
    params = result.copy()
    params["resource_id"] = resource_id
    requests.post(url, headers=dict(Authorization=apikey), params=params)
712353
function handleVote(link) {
    if (!opts.voting) {
      showError("You'll need to login to vote.");
      return;
    }

    var id = link.attr('id');
    if (!id) {
      // Didn't click on one of the voting arrows.
      return;
    }
    // If it is an unvote, the new vote value is 0,
    // Otherwise it's 1 for an upvote, or -1 for a downvote.
    var value = 0;
    if (id.charAt(1) != 'u') {
      value = id.charAt(0) == 'u' ? 1 : -1;
    }
    // The data to be sent to the server.
    var d = {
      comment_id: id.substring(2),
      value: value
    };

    // Swap the vote and unvote links.
    link.hide();
    $('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id)
      .show();

    // The div the comment is displayed in.
    var div = $('div#cd' + d.comment_id);
    var data = div.data('comment');

    // If this is not an unvote, and the other vote arrow has
    // already been pressed, unpress it.
    if ((d.value !== 0) && (data.vote === d.value * -1)) {
      $('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide();
      $('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show();
    }

    // Update the comments rating in the local data.
    data.rating += (data.vote === 0) ? d.value : (d.value - data.vote);
    data.vote = d.value;
    div.data('comment', data);

    // Change the rating text.
    div.find('.rating:first')
      .text(data.rating + ' point' + (data.rating == 1 ? '' : 's'));

    // Send the vote information to the server.
    $.ajax({
      type: "POST",
      url: opts.processVoteURL,
      data: d,
      error: function(request, textStatus, error) {
        showError('Oops, there was a problem casting that vote.');
      }
    });
  }
919839
function checkLink()
    {
        if (!isset($_POST['link'])) {
            $this->sendError();
        }

        $link = strtolower(str_replace([" ",'"',"'",';','.',','], ["-",""], preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities(trim($_POST['link'])))));

        $base = new Model\Base;
        $status = $base->checkLink($link, $_POST['aID']) === false ? 'ok' : 'error';

        $this->send(['status'=>$status,'link'=>$link]);
    }
479503
def http_action_post(url, data = {})
      @site[url].post data, @auth_params do |response, _request, _result, &_block|
        check_response response
      end
    end
1368697
def post(self, client_method, data, post_params=None, is_json=True):
        """"""
        url = self._wa.apollo_url + self.CLIENT_BASE + client_method

        if post_params is None:
            post_params = {}

        headers = {
            'Content-Type': 'application/json'
        }

        data.update({
            'username': self._wa.username,
            'password': self._wa.password,
        })

        curl_command = ['curl', url]
        for (k, v) in headers.items():
            curl_command += ['-H', quote('%s: %s' % (k, v))]
        curl_command += ['-d', quote(json.dumps(data))]
        log.info(' '.join(curl_command))

        resp = requests.post(url, data=json.dumps(data),
                             headers=headers, verify=self.__verify,
                             params=post_params, allow_redirects=False,
                             **self._request_args)

        if resp.status_code == 200 or resp.status_code == 302:
            if is_json:
                data = resp.json()
                return self._scrub_data(data)
            else:
                return resp.text

        # @see self.body for HTTP response body
        raise Exception("Unexpected response from apollo %s: %s" %
                        (resp.status_code, resp.text))
408980
def _post(self, url, data={}, **kwargs):
        """"""
        if 'files' in kwargs:
            req = self._session.post(self._api_prefix + url, auth=self._session.auth, data=data, **kwargs)
            return self._action(req)

        req = self._session.post(self._api_prefix + url, data=data, **kwargs)
        return self._action(req)
413650
def run_check200(_):
    '''
    
    '''

    tstr = ''
    idx = 1
    for kind in config.router_post.keys():
        posts = MPost.query_all(kind=kind, limit=20000)
        for post in posts:
            the_url0 = '{site_url}/{kind_url}/{uid}'.format(
                site_url=config.SITE_CFG['site_url'],
                kind_url=config.router_post[post.kind],
                uid=post.uid)

            the_url = '{site_url}/{kind_url}/_edit/{uid}'.format(
                site_url=config.SITE_CFG['site_url'],
                kind_url=config.router_post[post.kind],
                uid=post.uid)
            req = requests.get(the_url0)

            if req.status_code == 200:
                pass
            else:
                print(the_url0)
                tstr = tstr + DT_STR.format(idx=str(idx).zfill(2), url0=the_url0, code=req.status_code, edit_link=the_url)
                idx = idx + 1

    time_local = time.localtime(timestamp())
    with open('xx200_{d}.html'.format(d=str(time.strftime("%Y_%m_%d", time_local))), 'w') as fileo:
        fileo.write(HTML_TMPL.format(cnt=tstr))
    print('Checking 200 finished.')
293332
def post(self, request, *args, **kwargs):
        """"""
        try:
            kwargs = self.load_object(kwargs)
        except Exception as e:
            return self.render_te_response({
                'title': str(e),
            })

        if not self.has_permission(request):
            return self.render_te_response({
                'title': 'No access',
            })
        return self.render_te_response(self.handle_dialog(*args, **kwargs))
358933
private function redirectPost()
    {
        if (!isset($_SERVER['REQUEST_URI'])) {
            return;
        }
        if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] != 'POST') {
            return;
        }
        if (!$this->cfg['prg']) {
            return;
        }
        if (!$this->status['submitted']) {
            return;
        }
        $this->debug->log('redirecting');
        $event = $this->eventManager->publish('page.redirect', null, array('location' => $_SERVER['REQUEST_URI']));
        $location = $event['location'];
        $this->debug->log('%cLocation:%c <a href="%s">%s</a>', 'font-weight:bold;', '', $location, $location);
        if (\headers_sent($file, $line)) {
            $this->debug->warn('headers alrady sent from '.$file.' line '.$line);
            return;
        }
        if ($event->isPropagationStopped()) {
            $this->debug->alert('<i class="fa fa-external-link fa-lg" aria-hidden="true"></i> Location: <a class="alert-link" href="'.\htmlspecialchars($location).'">'.\htmlspecialchars($location).'</a>', 'info');
        } else {
            \header('Location: '.$location);
        }
        throw new \Exception('exit');
    }
308098
def _post(self, url, data={}):
        """"""
        r = requests.post(self._api_prefix + url,
            data=json.dumps(data),
            headers=self.headers,
            auth=self.auth,
            allow_redirects=False,
        )
        return self._action(r)
89017
function checkLink(s) {
        return ((s.indexOf("http") === 0) || (s.indexOf(SLASH) === 0)) ? "<a href='" + s + "'>" + s + "</a>" : s;
    }
426636
def post(self):
    """"""
    client_customer_id = self.request.get('clientCustomerId')
    budget_id = self.request.get('budgetId')
    if not client_customer_id or not budget_id:
      self.redirect('/')
    else:
      self.redirect('/showBudget?clientCustomerId=%s&budgetId=%s'
                    % (client_customer_id, budget_id))
1081691
def _check_link_completion(self, link, fail_pending=False, fail_running=False):
        

        status_vect = JobStatusVector()
        for job_key, job_details in link.jobs.items():
            # if job_details.status == JobStatus.failed:
            #    failed = True
            #    continue
            # elif job_details.status == JobStatus.done:
            #    continue
            if job_key.find(JobDetails.topkey) >= 0:
                continue
            job_details.status = self._interface.check_job(job_details)
            if job_details.status == JobStatus.pending:
                if fail_pending:
                    job_details.status = JobStatus.failed
            elif job_details.status == JobStatus.running:
                if fail_running:
                    job_details.status = JobStatus.failed
            status_vect[job_details.status] += 1
            link.jobs[job_key] = job_details
            link._set_status_self(job_details.jobkey, job_details.status)

        return status_vect
1243101
def _check_if_complete(self, url, json_response):
        
        if '__done' in json_response and isinstance(json_response, list):
            mr_parts = list(urlparse(url))
            mr_query = parse_qs(mr_parts[4])
            mr_query['mr'] = '"' + str(json_response[0]) + '"'
            mr_parts[4] = urlencode(mr_query, True)
            mr_link = urlunparse(mr_parts)
            mr_j, mr_r = self._ajax(mr_link)
            self.log.debug('MultipleRedirect link: %s', mr_link)
            return super(Installer, self)._check_if_complete(url, mr_j)

        return False
1264139
def _post(url, data, content_type, params=None):
        """"""
        try:
            response = requests.post(url, params=params, data=data, headers={
                'Content-Type': content_type,
            })
            response.raise_for_status()
            return response.json()
        except NameError:
            url = '{0}?{1}'.format(url, urllib.urlencode(params))
            req = urllib2.Request(url, data.encode(ENCODING), {
                'Content-Type': content_type,
            })
            return json.loads(urllib2.urlopen(req).read().decode(ENCODING))
1209626
function checkUrl(link, baseUrl, cache, options, retry)
{
	var cached;
	
	if (retry === undefined)
	{
		if (isString(link) === true)
		{
			link = linkObj(link);
			linkObj.resolve(link, baseUrl, options);
		}
		
		// TODO :: move out to an `linkObj.invalidate()` to share with `HtmlChecker()` ?
		if (link.url.resolved === null)
		{
			link.broken = true;
			link.brokenReason = "BLC_INVALID";
			linkObj.clean(link);
			return Promise.resolve(link);
		}
		
		cached = cache.get(link.url.parsed);
		
		if (cached !== undefined)
		{
			return Promise.resolve(cached).then( function(response)
			{
				// Cloned to avoid unexpected mutations as a result of user changes
				response = extend({}, response);
				
				copyResponseData(response, link, options);
				
				link.http.cached = true;
				
				return link;
			});
		}
	}
	
	var request = bhttp.request(link.url.resolved,  // TODO :: https://github.com/joepie91/node-bhttp/issues/3
	{
		discardResponse: true,
		headers: { "user-agent":options.userAgent },
		method: retry!==405 ? options.requestMethod : "get"
	})
	.then( function(response)
	{
		response = simpleResponse(response);
		
		if (response.statusCode===405 && options.requestMethod==="head" && options.retry405Head===true && retry!==405)
		{
			// Retry possibly broken server with "get"
			return checkUrl(link, baseUrl, cache, options, 405);
		}
		
		// TODO :: store ALL redirected urls in cache
		if (options.cacheResponses===true && response.url!==link.url.resolved)
		{
			cache.set(response.url, response);  // TODO :: store `request` instead to be consistent?
		}
		
		return response;
	})
	.catch( function(error)
	{
		// The error will be stored as a response
		return error;
	});
	
	if (retry === undefined)
	{
		// Send response to cache -- it will be available to `cache.get()` before being resolved
		if (options.cacheResponses === true)
		{
			cache.set(link.url.parsed, request);
		}
		
		// Send linkObj to caller
		return request.then( function(response)
		{
			copyResponseData(response, link, options);
			
			link.http.cached = false;
			
			return link;
		});
	}
	else
	{
		return request;
	}
}
767119
def _post(self, url, data=None, json=None, params=None, headers=None):
        """"""
        url = self.clean_url(url)
        response = requests.post(url, data=data, json=json, params=params,
                                 headers=headers, timeout=self.timeout,
                                 verify=self.verify)
        return response