Perform a request
163661
function req (method, url, query, body, done) {
	request({
		method: method,
		url: url,
		qs: query,
		body: body,
		json: true
	}, function (err, res, body) {
		if (err) {
			return done(err);
		}
		if (res.statusCode > 299) {
			var message = (body && body.message ? body.message : 'Error ' + res.statusCode);
			return done(new Error(message));
		}
		done(null, body);
	});
}
407968
def request(self, method, url, **kwargs):
        '''
        '''
        # TODO should we raise an exception if auth or cookies are explicitly
        # mentioned in kwargs?
        kwargs['auth'] = self.auth()
        kwargs['cookies'] = self.cookies
        return requests.request(method=method, url=url, **kwargs)
373353
def request(method, path, options, raw=false)
      before_request
      response = connection(raw).send(method) do |request|
        case method
        when :get, :delete
          request.url(formatted_path(path), options)
        when :patch, :post, :put
          request.path = formatted_path(path)
          request.headers['Content-Type'] = 'application/json'
          request.body = options.to_json unless options.empty?
        end
      end
      raw ? response : response.body
    end
586009
def request(verb, uri, opts = {}) # rubocop:disable Style/OptionHash
      opts = @default_options.merge(opts)
      req = build_request(verb, uri, opts)
      res = perform(req, opts)
      return res unless opts.follow

      Redirector.new(opts.follow).perform(req, res) do |request|
        perform(request, opts)
      end
    end
1073781
def post(path, options = {}, headers = {}, raw = false)
      request(:post, path, options, headers, raw)
    end
1201797
function request(uri, opt, callback) {
    if (typeof opt === 'function') {
        callback = opt;
        opt = {};
    }
    return hyperquest(uri, opt, callback);
}
448139
def request(*args)
      response = make_request(*args)
      # binding.pry unless response.kind_of?(Net::HTTPSuccess)
      raise HTTPError, response unless response.is_a?(Net::HTTPSuccess)
      response
    end
471194
def request(self, type, command_list):
        '''
        
        '''
        req = self._build_request(type, command_list)
        if self.nxargs['connect_over_uds']:
            self.connection.request('POST', req['url'], req['payload'], req['headers'])
            response = self.connection.getresponse()
        else:
            response = self.connection(req['url'],
                                       method='POST',
                                       opts=req['opts'],
                                       data=req['payload'],
                                       header_dict=req['headers'],
                                       decode=True,
                                       decode_type='json',
                                       **self.nxargs)

        return self.parse_response(response, command_list)
1215484
def _request(self, path, method, body=None):
        """"""
        url = '/'.join([_SERVER, path])
        (resp, content) = _HTTP.request(url, method,
                                        headers=self._headers, body=body)

        content_type = resp.get('content-type')
        if content_type and content_type.startswith('application/json'):
            content = json.loads(content.decode('UTF-8'))

        return (resp, content)
649227
def _do_request(self, url, params=None, data=None, headers=None):
        

        if not headers:
            headers = {'content-type': 'application/json'}

        try:
            response = requests.get(
                url, params=params, data=data, headers=headers)
        except:
            return None

        if response.status_code == 200:
            return response
1356215
def _request(self, path, method, body=None):
        ""
        h = httplib2.Http()
        resp, content = h.request(
            self.base_url + path,
            method,
            body = json.dumps(body),
        )
        if resp['status'] == "200":
            return json.loads(content)
        else:
            raise IOError(
                "Got %s reponse from server (%s)" % (
                    resp['status'],
                    content,
                )
            )
692427
def request(self, *args, **kwargs):
        """"""
        try:
            return self._http.request(*args, timeout=TIMEOUT, **kwargs)
        except Exception as exc:
            raise RequestException(exc, args, kwargs)
208668
def __make_request(self, requests_session, method, url, params, data, headers, certificate):
        
        verify = False
        timeout = self.timeout

        try:  # TODO : Remove this ugly try/except after fixing Java issue: http://mvjira.mv.usa.alcatel.com/browse/VSD-546
            response = requests_session.request(method=method,
                                        url=url,
                                        data=data,
                                        headers=headers,
                                        verify=verify,
                                        timeout=timeout,
                                        params=params,
                                        cert=certificate)
        except requests.exceptions.SSLError:
            try:
                response = requests_session.request(method=method,
                                            url=url,
                                            data=data,
                                            headers=headers,
                                            verify=verify,
                                            timeout=timeout,
                                            params=params,
                                            cert=certificate)
            except requests.exceptions.Timeout:
                return self._did_timeout()

        except requests.exceptions.Timeout:
            return self._did_timeout()

        return response
94184
def make_request(self, method, path, headers=None, data='', host=None,
                     auth_path=None, sender=None, override_num_retries=None):
        """"""
        http_request = self.build_base_http_request(method, path, auth_path,
                                                    {}, headers, data, host)
        return self._mexe(http_request, sender, override_num_retries)
511157
def post(path, options={}, raw=false, unformatted=true)
      request(:post, path, options, raw, unformatted)
    end
1164585
async def request(self, method, path, json=None, auth=True):
        """"""
        url = 'http://{}/api/'.format(self.host)
        if auth:
            url += '{}/'.format(self.username)
        url += path

        try:
            async with self.websession.request(method, url, json=json) as res:
                if res.content_type != 'application/json':
                    raise ResponseError(
                        'Invalid content type: {}'.format(res.content_type))
                data = await res.json()
                _raise_on_error(data)
                return data
        except client_exceptions.ClientError as err:
            raise RequestError(
                'Error requesting data from {}: {}'.format(self.host, err)
            ) from None
752605
def _request(self, method, resource_uri, **kwargs):
        
        data = kwargs.get('data')
        response = method(self.API_BASE_URL + resource_uri,
                          json=data, headers=self.headers)
        response.raise_for_status()
        return response.json()