returns curl (response) info from Pycurl object
354497
def curl_info(crl):
    
    kbps = crl.getinfo(crl.SPEED_DOWNLOAD) / 1000.0
    url = crl.getinfo(crl.EFFECTIVE_URL)
    url = url.replace("&format=json", '').replace("&formatversion=2", '')

    # https://travis-ci.org/siznax/wptools/jobs/401109410
    try:
        content_type = crl.getinfo(crl.CONTENT_TYPE)
    except TypeError:
        content_type = None

    return {"url": url,
            "user-agent": user_agent(),
            "content-type": content_type,
            "status": crl.getinfo(crl.RESPONSE_CODE),
            "bytes": crl.getinfo(crl.SIZE_DOWNLOAD),
            "seconds": "%5.3f" % crl.getinfo(crl.TOTAL_TIME),
            "kB/s": "%3.1f" % kbps}
670843
private function createCurl()
    {
        $parameters = $this->getParameters();
        $timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0) * 1000;

        if (filter_var($host = $parameters->host, FILTER_VALIDATE_IP)) {
            $host = "[$host]";
        }

        $options = array(
            CURLOPT_FAILONERROR => true,
            CURLOPT_CONNECTTIMEOUT_MS => $timeout,
            CURLOPT_URL => "$parameters->scheme://$host:$parameters->port",
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_POST => true,
            CURLOPT_WRITEFUNCTION => array($this, 'feedReader'),
        );

        if (isset($parameters->user, $parameters->pass)) {
            $options[CURLOPT_USERPWD] = "{$parameters->user}:{$parameters->pass}";
        }

        curl_setopt_array($resource = curl_init(), $options);

        return $resource;
    }
1362701
private function get_curl_info() {
		if ( function_exists( 'curl_version' ) ) {
			$curl = curl_version();
			$msg  = $curl['version'];
			if ( ! $curl['features'] && CURL_VERSION_SSL ) {
				$msg .= ' - NO SSL SUPPORT';
			}
		}
		else {
			$msg = 'No CURL installed';
		}

		return $msg;
	}
1120668
def api_url(self):
        ''''''
        return pathjoin(Request.path, self.id, url=self.bin.api_url)
109125
def get_curl_command_line(self, method, url, **kwargs):
        """"""
        if kwargs.get("query"):
            url = "{}?{}".format(url, d1_common.url.urlencode(kwargs["query"]))
        curl_list = ["curl"]
        if method.lower() == "head":
            curl_list.append("--head")
        else:
            curl_list.append("-X {}".format(method))
        for k, v in sorted(list(kwargs["headers"].items())):
            curl_list.append('-H "{}: {}"'.format(k, v))
        curl_list.append("{}".format(url))
        return " ".join(curl_list)
3828
protected function _getCURL($url) {
		curl_setopt($this->_curl, CURLOPT_URL, $url);
		$content = curl_exec($this->_curl);
		return $content;
	}
1149372
def get_dict_from_response(response):
    """"""
    if getattr(response, '_resp') and response._resp.code > 400:
        raise OAuthResponseError(
                'Application mis-configuration in Globus', None, response
            )

    return response.data
262044
static function CurlGet($url, $data = "", $verify_cert = false, $timeout = 30)
	{
		return HttpRequest::CurlRequest("GET",$url, $data, $verify_cert, $timeout);
	}
627713
def _extract_program_from_pyquil_executable_response(response: PyQuilExecutableResponse) -> Program:
    
    p = Program(response.program)
    for attr, val in response.attributes.items():
        setattr(p, attr, val)
    return p
846362
def _extract_key_info(self, request):
        
        from scrapy.utils.request import request_fingerprint

        key_generator = request.meta.get('qiniu_key_generator')
        if key_generator:
            tmp = key_generator(request.url)
            bucket = tmp['bucket'] or self.bucket
            key = tmp['key']
        else:
            bucket = self.bucket
            key = '%s%s' % (self.key_prefix, request_fingerprint(request))

        return {'bucket': bucket, 'key': key}
449034
def geturl_req(url):
    """"""
    request = urllib.request.Request(url)
    request.add_header('Authorization', 'token %s' % API_TOKEN)
    try:
        response_url = urllib.request.urlopen(request).geturl()
        return response_url
    except urllib.error.HTTPError:
        exception()
        sys.exit(0)
353080
def get_pr_info(requester, reponame, number):
    ""
    resp = requester.get(
        'https://api.github.com/repos/%s/pulls/%s' % (reponame, number))
    return PRInfo(resp.json())
409322
def _get_headers(self):
        """"""
        headers = {
            'user-agent': 'IPinfoClient/Python{version}/1.0'.format(version=sys.version_info[0]),
            'accept': 'application/json'
        }

        if self.access_token:
            headers['authorization'] = 'Bearer {}'.format(self.access_token)

        return headers
1132292
private function executeCurl ()
    {
        $result = curl_exec($this->cURL);

        if (!$result)
        {
            throw new CurlException($this->cURL);
        }

        return $result;
    }
1044913
def _get_info(self, host, port, unix_socket, auth):
        

        client = self._client(host, port, unix_socket, auth)
        if client is None:
            return None

        info = client.info()
        del client
        return info
267613
def __fetch_data(self, url):
        
        url += '&api_key=' + self.api_key
        try:
            response = urlopen(url)
            root = ET.fromstring(response.read())
        except HTTPError as exc:
            root = ET.fromstring(exc.read())
            raise ValueError(root.get('message'))
        return root
1087286
def fetch_data(self, url):
        ''' 
        
        '''
        return self.http._post_data(url, None, self.http._headers_with_access_token())