Request a URL using the HTTP method PUT.
776942
def putURL(self, url, headers, body=None):
        
        return self._load_resource("PUT", url, headers, body)
799677
def _request(self, http_method, relative_url='', **kwargs):
        """"""
        # It could be possible to call api.resource.get('/index')
        # but it would be non-intuitive that the path would resolve
        # to root of domain
        relative_url = self._remove_leading_slash(relative_url)

        # Add default kwargs with possible custom kwargs returned by
        # before_request
        new_kwargs = self.default_kwargs().copy()
        custom_kwargs = self.before_request(
            http_method,
            relative_url,
            kwargs.copy()
        )
        new_kwargs.update(custom_kwargs)

        response = requests.request(
            http_method,
            self._join_url(relative_url),
            **new_kwargs
        )

        return self.after_request(response)
280214
def _request(self, url, request_type='GET', **params):
        """"""
        try:
            _LOGGER.debug('Request %s %s', url, params)
            response = self.request(
                request_type, url, timeout=TIMEOUT.seconds, **params)
            response.raise_for_status()
            _LOGGER.debug('Response %s %s %.200s', response.status_code,
                          response.headers['content-type'], response.json())
            response = response.json()
            if 'error' in response:
                raise OSError(response['error'])
            return response
        except OSError as error:
            _LOGGER.warning('Failed request: %s', error)
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
680433
async def api_put(self, url, data=None):
        """"""
        put = None
        headers = DEFAULT_HEADERS.copy()
        headers.update({'Session-Token': self._token})

        try:
            with async_timeout.timeout(DEFAULT_TIMEOUT, loop=self._event_loop):
                put = await self._api_session.put(
                    url, headers=headers, data=data)
            if put.status != 200:
                _LOGGER.error('Error putting Eight data: %s', put.status)
                return None

            if 'application/json' in put.headers['content-type']:
                put_result = await put.json()
            else:
                _LOGGER.debug('Response was not JSON, returning text.')
                put_result = await put.text()

            return put_result

        except (aiohttp.ClientError, asyncio.TimeoutError,
                ConnectionRefusedError) as err:
            _LOGGER.error('Error putting Eight data. %s', err)
            return None
584152
def put(path, options = {}, &block)
      perform_request Net::HTTP::Put, path, options, &block
    end
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)
389174
def _request(self, uri, params=None, postParams=None, verb='GET'):
        """"""
        return getattr(requests, verb.lower())(self.url + uri, params=params, data=postParams, stream=True)
18010
def _http_request(self, method, url, request_kwargs=None):
        

        kwargs = request_kwargs if request_kwargs is not None else {}

        headers = self._request_headers()
        headers.update(self.additional_headers)
        if 'headers' in kwargs:
            headers.update(kwargs['headers'])
        kwargs['headers'] = headers

        if self._has_proxy():
            kwargs['proxies'] = self._proxy_parameters()

        request_url = self._url(
            url,
            file_upload=kwargs.pop('file_upload', False)
        )

        request_method = getattr(requests, method)
        response = request_method(request_url, **kwargs)

        if response.status_code == 429:
            raise RateLimitExceededError(response)

        return response
522028
public static String put(String url, String body) {
        return request(HttpRequest.put(replaceLocalHost(url)), body).body();
    }
145426
def _put(self, url, data={}):
        """"""
        req = self._session.put(self._api_prefix + url, data=data)
        return self._action(req)
725453
def put(self, path, payload):
        """"""
        body = json.dumps(payload)
        return self._request(path, 'PUT', body)
44657
def put(self, endpoint, **kwargs):
        
        return self._request(requests.put, endpoint, **kwargs)
960465
public Object putRequest(String restUrl, Map<String, String> params) throws IOException, WebServiceException {
		return this.postRequest(HttpMethod.PUT, restUrl, params);
	}
309591
def create_http_request(http_method, path, *arguments)
      http_method = http_method.to_sym

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

      # if the base site contains a path, add it now
      # only add if the site host matches the current http object's host
      # (in case we've specified a full url for token requests)
      uri  = URI.parse(site)
      path = uri.path + path if uri.path && uri.path != '/' && uri.host == http.address

      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 :patch
        request = Net::HTTP::Patch.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)
      when :head
        request = Net::HTTP::Head.new(path,headers)
      else
        raise ArgumentError, "Don't know how to handle http_method: :#{http_method.to_s}"
      end

      if data.is_a?(Hash)
        request.body = OAuth::Helper.normalize(data)
        request.content_type = 'application/x-www-form-urlencoded'
      elsif data
        if data.respond_to?(:read)
          request.body_stream = data
          if data.respond_to?(:length)
            request["Content-Length"] = data.length.to_s
          elsif data.respond_to?(:stat) && data.stat.respond_to?(:size)
            request["Content-Length"] = data.stat.size.to_s
          else
            raise ArgumentError, "Don't know how to send a body_stream that doesn't respond to .length or .stat.size"
          end
        else
          request.body = data.to_s
          request["Content-Length"] = request.body.length.to_s
        end
      end

      request
    end
325473
def _put(self, url, attributes=None, **kwargs):
        

        return self._request('put', url, attributes, **kwargs)
539867
function httpRequest(url) {
    var deferred = Q.defer();
    request(url, function(err, response, body) {
      if (err) {
        deferred.reject(new Error(err));
      } else if (!err && response.statusCode !== 200) {
        deferred.reject(new Error(response.statusCode));
      } else {
        deferred.resolve(body);
      }
    });
    return deferred.promise;
  }