Request object
Params:
- httpClient: httpClient
- url
- method: http method
- headers
- params
- payload
775308
function Request(httpClient, url, method, headers, params, payload) {
    url = urlparse.parse(url, true); // query string parsing
    this.httpClient   = httpClient;
    this.scheme       = url.protocol.substr(0, url.protocol.length - 1);
    this.port         = url.port ? url.port : (this.scheme === 'http' ? 80 : 443);
    this.host         = url.hostname;
    this.method       = method;
    this.path_info    = url.pathname;
    this.query_string = url.query || {};
    this.headers      = headers || {},
    this.params       = params || {};
    this.payload      = payload || null;
    this.headers['host'] = url.hostname;
}
352054
def request(self, url, method="GET", params=None, headers=None, is_signed=True):
        
        params = params or {}
        headers = headers or {}
        
        if is_signed:
            params.update(self.get_signing_params())
        
        if method.upper() == "GET":
            url = '%s?%s' % (url, urllib.urlencode(params))
            return self.client().request(url, method=method, headers=headers)
        return self.client().request(url, method, body=urllib.urlencode(params), headers=headers)
459511
function(method, params, payload) {
        var baseUrl   = (method.base_url || this.spec.base_url).replace(/(\/)$/, '');
        var headers   = {};
        for (var header in method.headers) {
            headers[header] = method.headers[header];
        }
        return simpleHttp.createRequest(this.httpClient, baseUrl + method.path, method.method, headers, params, payload);
    }
381156
function Request (opts) {
  var self = this
  if (!(self instanceof Request)) return new Request(opts)
  if (!opts) opts = {}

  self.HTTPMethod = opts.method
  self.HTTPHeaders = {}
  self.opts = opts

  if (opts.method === 'POST') {
    if (opts.endpoint) {
      self._initPOST(opts)
    } else if (opts.url) {
      self._initPOSTURL(opts)
    } else {
      throw new Error('invalid request')
    }
  } else if (opts.method === 'GET') {
    self._initGET(opts)
  } else {
    throw new Error('invalid request')
  }
}
1363495
def request_payload(cls, request, request_id):
        ''''''
        payload = {
            'jsonrpc': '2.0',
            'method': request.method,
        }
        # A notification?
        if request_id is not None:
            payload['id'] = request_id
        # Preserve empty dicts as missing params is read as an array
        if request.args or request.args == {}:
            payload['params'] = request.args
        return payload
65408
def request(self, url, method="GET", params=None, headers=None):
        
        params = params or {}
        headers = headers or {}

        logger.debug("URL: %s", url)
        logger.debug("Method: %s", method)
        logger.debug("Headers: %s", headers)
        logger.debug("Params: %s", params)
        
        response, content = self.client().request(url, method, headers=headers,
            body=urllib.urlencode(params))
        
        content = smart_unicode(content)

        logger.debug("Status: %s", response['status'])
        logger.debug("Content: %s", content)
        
        if response['status'] != '200':
            raise OAuthError(_(
                u"Invalid status code %s while requesting %s: %s") % (
                    response['status'], url, content))
        
        return content
372698
def to_requests(self, method='get'):
        
        out = {}
        data_key = 'params' if method.lower() == 'get' else 'data'
        out[data_key] = self.data
        out.update(self.options)
        return dict([
            (key, list(value.items(multi=True)))
            for key, value in iteritems(out)
        ])
626260
def _req(self, method="get", verb=None, headers={}, params={}, data={}):
        
        url = self.BASE_URL.format(verb=verb)
        request_headers = {"content-type": "application/json"}
        request_params = {"api_key": self.API_KEY}
        request_headers.update(headers)
        request_params.update(params)
        return getattr(requests, method)(
            url, params=request_params, headers=request_headers, data=data
        )
287758
def _make_request(self, method, url, post_data=None, body=None):
        
        if not self.connection:
            self._connect()
        try:
            self.connection.close()
        except:
            pass
        self.connection.connect()
        headers = {}
        if self.auth_header:
            headers["Authorization"] = self.auth_header
        self.connection.request(method, url, body, headers)
        resp = self.connection.getresponse()
        return resp
639249
def parse(cls, payload):
        
        try:
            method, args, ref = payload
        except Exception as exception:
            raise RequestParseError(exception)
        else:
            return method, args, ref
1270807
def httpapi_request(client, **params) -> 'Response':
    
    return requests.get(
        _HTTPAPI,
        params={
            'client': client.name,
            'clientver': client.version,
            'protover': 1,
            **params
        })
1016432
def handle_single_request(self, request_object):
        
        if not isinstance(request_object, (MethodCall, Notification)):
            raise TypeError("Invalid type for request_object")

        method_name = request_object.method_name
        params = request_object.params
        req_id = request_object.id

        request_body = self.build_request_body(method_name, params, id=req_id)
        http_request = self.build_http_request_obj(request_body)

        try:
            response = urllib.request.urlopen(http_request)
        except urllib.request.HTTPError as e:
            raise CalledServiceError(e)

        if not req_id:
            return

        response_body = json.loads(response.read().decode())
        return response_body
210610
def request(self, method, params, session):
        
        session = session or self.client.session
        request = self.create_req(method, params)
        date_time_sent = datetime.datetime.utcnow()
        try:
            response = session.post(
                self.url,
                data=request,
                headers=self.client.request_headers,
                timeout=(self.connect_timeout, self.read_timeout)
            )
        except ConnectionError:
            raise APIError(None, method, params, 'ConnectionError')
        except Exception as e:
            raise APIError(None, method, params, e)
        elapsed_time = (datetime.datetime.utcnow()-date_time_sent).total_seconds()

        check_status_code(response)
        try:
            response_data = response.json()
        except ValueError:
            raise InvalidResponse(response.text)

        if self._error_handler:
            self._error_handler(response_data, method, params)
        return response_data, elapsed_time
263461
def create_http_request(http_method, path, *arguments)
        http_method = http_method.to_sym

        if [:post, :put].include?(http_method)
          data = arguments.shift
        end

        headers = arguments.first.is_a?(Hash) ? arguments.shift : {}

        case http_method
        when :post
          request = Net::HTTP::Post.new(path,headers)
          request["Content-Length"] = 0 # Default to 0
        when :put
          request = Net::HTTP::Put.new(path,headers)
          request["Content-Length"] = 0 # Default to 0
        when :get
          request = Net::HTTP::Get.new(path,headers)
        when :delete
          request =  Net::HTTP::Delete.new(path,headers)
        else
          raise ArgumentError, "Don't know how to handle http_method: :#{http_method.to_s}"
        end
      
        # handling basic http auth
        request.basic_auth @config[:username], @config[:password]

        if data.is_a?(Hash)
          request.set_form_data(data)
        elsif data
          request.body = data.to_s
          request["Content-Length"] = request.body.length
        end

        request
      end
479404
def request(self, method, url, *args):
        
        return self.http.request(method, url, *args)
248008
def response
      request_headers = headers.merge(params: params)

      RestClient::Request.execute(
        method: :get,
        url: url,
        timeout: OpenComponents.config.timeout,
        headers: request_headers
      )
    rescue RestClient::ResourceNotFound => e
      fail ComponentNotFound, e.message
    rescue RestClient::RequestTimeout => e
      fail RegistryTimeout, e.message
    end
1332881
def request(cls, method, url, **kwargs):
		
		methodupper = method.upper()
		hasdata = 'data' in kwargs
		if methodupper == 'GET':
			if hasdata:
				print("ERROR: Can't do HTTP GET when the 'data' parameter presents")
				assert False
			resp = ulr.urlopen(url, **kwargs)
		elif methodupper == 'POST':
			if hasdata:
				resp = ulr.urlopen(url, **kwargs)
			else:
				resp = ulr.urlopen(url, data = '', **kwargs)
		else:
			raise NotImplementedError()

		return resp