:param method: str, http method ["GET","POST","PUT"]
        :param suffix: the url suffix
        :param data:
        :return:
359810
def request(self, method, suffix, data):
        
        url = self.site_url + suffix
        response = self.session.request(method, url, data=data)

        if response.status_code == 200:
            json_obj = response.json()

            if isinstance(json_obj, dict) and json_obj.get("error_code"):

                raise WeiboOauth2Error(
                    json_obj.get("error_code"),
                    json_obj.get("error"),
                    json_obj.get('error_description')
                )
            else:
                return json_obj
        else:
            raise WeiboRequestError(
                "Weibo API request error: status code: {code} url:{url} ->"
                " method:{method}: data={data}".format(
                    code=response.status_code,
                    url=response.url,
                    method=method,
                    data=data
                )
            )
348146
def request(method, uri, data: nil, headers: {}, **kwargs)
      request = Request.new(
        headers: default_headers.merge(headers),
        **kwargs,
        method: method,
        uri: join(uri),
        data: data
      )

      ret = cache.call(request) {|req| adapter.call(req) }
      ret.then do |response|
        if !response.errored?
          process response
        else
          raise ResponseError.from_code(response)
        end
      end
    end
451291
def put(self, url, data=None, body=None):
        
        response = self.http.put(url,
                                 headers=self.headers,
                                 data=body,
                                 params=data,
                                 **self.requests_params)

        return self.process(response)
815180
def post(self, data):
        
        uri = '{}/sinkhole'.format(self.client.remote)
        self.logger.debug(uri)

        if PYVERSION == 2:
            try:
                data = data.decode('utf-8')
            except Exception:
                data = data.decode('latin-1')

        data = {
            'message': data
        }

        body = self.client.post(uri, data)
        return body
394411
function(method, data, callback) {
      xhr.open(method, url, true, user, password);
      if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");
      if (xhr.setRequestHeader) headers.each(function(value, name) { xhr.setRequestHeader(name, value); });
      if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType);
      if (responseType != null) xhr.responseType = responseType;
      if (timeout > 0) xhr.timeout = timeout;
      if (callback == null && typeof data === "function") callback = data, data = null;
      if (callback != null && callback.length === 1) callback = fixCallback(callback);
      if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); });
      event.call("beforesend", request, xhr);
      xhr.send(data == null ? null : data);
      return request;
    }
337846
def http_post(url, data)
    req = HTTPI::Request.new(:url => url, :body => data)
    return HTTPI.post(req).body
  end
413410
function(uri, method, headers, data, encType) {
    var config = this.config;
    var flags = [];
    var str;

    method = method || 'GET';

    if (data && method.toLowerCase() === 'get') {
      uri += this.buildQueryString(data);
    }

    str = ['curl', this.buildFlag('X', method.toUpperCase(), 0, ''), '"' + uri + '"'].join(' ');

    if (headers) {
      _.each(headers, function(val, header) {
        flags.push(this.buildFlag('H', header + config.HEADER_SEPARATOR + val, 5));
      }, this);
    }

    if (data && method.toLowerCase() !== 'get') {
      if (encType === undefined || encType.match(this.formatter.jsonMediaType)) {
        flags.push(this.buildFlag('-data', this.formatData(data), 5, '\''));
      } else if (encType === 'multipart/form-data') {
        flags.push(this.buildFlag('-form', this.formatForm(data), 5, '"'));
      } else {
        // The non-JSON, non-multipart data is a raw string.  Do not format it.
        flags.push(this.buildFlag('-data', data));
      }
    }

    if (flags.length) {
      return str + config.NEW_LINE + flags.join(config.NEW_LINE);
    }
    return str;
  }
925995
def request(http_method, data={}, url="")
      final_url = @options[:base_url] << url
        begin
          case http_method
              when :get
                response = Curl.get(final_url, data) do |http|
                  http.headers['x-api-key'] = @options[:api_key]
                  http.headers['Accept'] = 'application/json'
                end
          end
        rescue Curl::Err::HostResolutionError
          raise Fulfil::HostResolutionError, "Invalid Subdomain"
        end
      parse_response response
    end
781294
def _get_url(method,
             api_url,
             api_version):
    '''
    
    '''
    return '{url}/{version}/{method}.json'.format(url=api_url,
                                                  version=float(api_version),
                                                  method=method)
569196
def send_method_request(self, method: str, method_params: dict) -> dict:
        
        url = '/'.join((self.METHOD_URL, method))
        method_params['v'] = self.API_VERSION
        if self._access_token:
            method_params['access_token'] = self._access_token
        response = self.post(url, method_params, timeout=10)
        response.raise_for_status()
        return json.loads(response.text)
1004999
private static HttpUriRequest createHttpUriRequest(String method, URI uri) {
        switch (method) {
            case "GET":
                return new HttpGet(uri);
            case "HEAD":
                return new HttpHead(uri);
            case "POST":
                return new HttpPost(uri);
            case "PUT":
                return new HttpPut(uri);
            case "PATCH":
                return new HttpPatch(uri);
            case "DELETE":
                return new HttpDelete(uri);
            case "OPTIONS":
                return new HttpOptions(uri);
            case "TRACE":
                return new HttpTrace(uri);
            default:
                throw new IllegalArgumentException("Invalid HTTP method: " + method);
        }
    }
1330440
def endpoint(url, method="GET", expected_status=200):
    
    def dec(obj):
        obj.ENDPOINT = url
        obj.METHOD = method
        obj.EXPECTED_STATUS = expected_status
        return obj

    return dec
858441
def _post(self, url, data=None, **kwargs):
        

        # Remove non-ASCII characters from filenames due to a limitation of the combination of
        # urllib3 (via python-requests) and our server
        # https://github.com/requests/requests/issues/2117
        # Internal Ticket #3090
        if "files" in kwargs and kwargs["files"] is not None:
            acceptable_chars = "0123456789" + "abcdefghijklmnopqrstuvwxyz" + \
                               "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + " _-.,()[]{}"
            for param_name, fp in kwargs["files"].items():
                if isinstance(fp, (tuple, list)):
                    filename, fp = fp
                else:
                    filename = requests.utils.guess_filename(fp) or param_name

                def encode(char):
                    try:
                        if char in acceptable_chars:
                            return char
                    except UnicodeDecodeError:
                        pass
                    return "x{:02x}".format(ord(char))
                filename = "".join(encode(x) for x in filename)

                kwargs["files"][param_name] = (filename, fp)

        for i in itertools.count(1):
            try:
                return self.session.post(url, data=data, timeout=self.timeout, **kwargs)
            except requests.exceptions.Timeout as e:
                # exhausted all retries
                if i >= self.retries:
                    raise ConnectionError(e)
            except requests.exceptions.RequestException as e:
                raise ConnectionError(e)

            # exponential backoff
            max_backoff = 4 ** i / 10   # .4, 1.6, 6.4, 25.6, ...
            time.sleep(random.uniform(0, max_backoff))
694679
def put(self, uri, data, **kwargs):
        
        return self.request("PUT", uri, data=data, **kwargs)
340201
def make_url(self, method):
        

        token = self.settings()['token']

        return TELEGRAM_URL.format(
            token=quote(token),
            method=quote(method),
        )
994613
function(method) {
		return function(path,data,callback) {
			if (typeof data === 'object') data = querystring.stringify(data);
			var options = route(path,method,'application/x-www-form-urlencoded',data.length);
			var request = protocol.request(options,response(callback)).on('error',callback);
			request.write(data);
			request.end();
		};
	}
647173
def request(self, method, url, **kwargs):
        

        if "data" in kwargs:
            kwargs["data"] = json.dumps(kwargs["data"])

        kwargs["headers"] = {
            'Content-Type': 'application/json',
            'Authorization': 'token %s' % self.__token__,
        }
        req = make_request(
            method,
            url,
            **kwargs
        )
        self.logger.debug(
            "Request::{}::{}".format(method, url),
            extra={
                "request": kwargs,
                "response": {"headers": req.headers, "code": req.status_code, "data": req.content}
            }
        )
        return req