Retrieve the appropriate request items for put or patch calls.
18453
def _prepare_put_or_patch(self, kwargs):
        """"""

        requests_params = self._handle_requests_params(kwargs)
        update_uri = self._meta_data['uri']
        session = self._meta_data['bigip']._meta_data['icr_session']
        read_only = self._meta_data.get('read_only_attributes', [])
        return requests_params, update_uri, session, read_only
79802
def _get_dispatches_for_update(filter_kwargs):
    """"""

    dispatches = Dispatch.objects.prefetch_related('message').filter(
        **filter_kwargs

    ).select_for_update(
        **GET_DISPATCHES_ARGS[1]

    ).order_by('-message__time_created')

    try:
        dispatches = list(dispatches)

    except NotSupportedError:
        return None

    except DatabaseError:  # Probably locked. That's fine.
        return []

    return dispatches
656974
def resource_collections_update(self, data, **kwargs):
        ""
        api_path = "/api/v2/resource_collections.json"
        return self.call(api_path, method="PUT", data=data, **kwargs)
25887
def patch(self, url, data=None, params=None):
        
        return self.request("patch", url, data, params)
608824
def patch(self, path, data, **options):
        
        data, options = self._update_request(data, options)
        return self.request('patch', path, data=data, **options)
862905
def derived_get_requests(self):
        

        host = self.queue_item.response.url
        soup = self.queue_item.get_soup_response()

        found_requests = []

        for form in soup.find_all("form"):
            found_requests.append(self.__get_request(host, form))

        return found_requests
657026
def prepare_request_params(self, _query_params, _json_params):
        
        self._query_params = dictset(
            _query_params or self.request.params.mixed())
        self._json_params = dictset(_json_params)

        ctype = self.request.content_type
        if self.request.method in ['POST', 'PUT', 'PATCH']:
            if ctype == 'application/json':
                try:
                    self._json_params.update(self.request.json)
                except simplejson.JSONDecodeError:
                    log.error(
                        "Expecting JSON. Received: '{}'. "
                        "Request: {} {}".format(
                            self.request.body, self.request.method,
                            self.request.url))

            self._json_params = BaseView.convert_dotted(self._json_params)
            self._query_params = BaseView.convert_dotted(self._query_params)

        self._params = self._query_params.copy()
        self._params.update(self._json_params)
567598
def prepare_params(req: snug.Request) -> snug.Request:
    """"""
    return req.replace(
        params={key: dump_param(val) for key, val in req.params.items()
                if val is not None})
1346065
def get_request_data():
    
    method = request.method.lower()
    if method in ["get", "delete"]:
        return request.args
    elif method in ["post", "put", "patch"]:
        if request.mimetype == 'application/json':
            try:
                return request.get_json()
            except:
                abort(400, "InvalidData", "invalid json content")
        else:
            return request.form
    else:
        return None
549574
def handle_get_request(self, environ, start_response):
        """"""
        connections = [
            s.strip()
            for s in environ.get('HTTP_CONNECTION', '').lower().split(',')]
        transport = environ.get('HTTP_UPGRADE', '').lower()
        if 'upgrade' in connections and transport in self.upgrade_protocols:
            self.server.logger.info('%s: Received request to upgrade to %s',
                                    self.sid, transport)
            return getattr(self, '_upgrade_' + transport)(environ,
                                                          start_response)
        try:
            packets = self.poll()
        except exceptions.QueueEmpty:
            exc = sys.exc_info()
            self.close(wait=False)
            six.reraise(*exc)
        return packets
252478
def versions_request(self):
        """"""
        ret = self.handle_api_exceptions('GET', '', api_ver='')
        return [str_dict(x) for x in ret.json()]
1330881
def handle_items(repo, **kwargs):
    """"""
    log.info('items: %s %s' %(repo, kwargs))
    if not hasattr(repo, 'items'):
        return []
    return [i.serialize() for i in repo.items(**kwargs)]
200723
def canonical_request(self, method, path, content, timestamp):
        """"""
        request = collections.OrderedDict([
            ('Method', method.upper()),
            ('Hashed Path', path),
            ('X-Ops-Content-Hash', content),
            ('X-Ops-Timestamp', timestamp),
            ('X-Ops-UserId', self.user_id),
        ])
        return '\n'.join(['%s:%s' % (key, value)
                          for key, value in request.items()])
1000915
def on_patch(resc, req, resp, rid):
    

    signals.pre_req.send(resc.model)
    signals.pre_req_update.send(resc.model)

    props = req.deserialize()
    model = find(resc.model, rid)

    from_rest(model, props)
    goldman.sess.store.update(model)

    props = to_rest_model(model, includes=req.includes)
    resp.last_modified = model.updated
    resp.serialize(props)

    signals.post_req.send(resc.model)
    signals.post_req_update.send(resc.model)
1120448
def rest_put(url, data, timeout):
    ''''''
    try:
        response = requests.put(url, headers={'Accept': 'application/json', 'Content-Type': 'application/json'},\
                                data=data, timeout=timeout)
        return response
    except Exception as e:
        print('Get exception {0} when sending http put to url {1}'.format(str(e), url))
        return None
796994
def process_request(self, request_object):
        """"""

        # Retrieve the object by its identifier
        entity = request_object.entity_cls.get(request_object.identifier)

        # Update the object and return the updated data
        resource = entity.update(request_object.data)
        return ResponseSuccess(Status.SUCCESS, resource)
672098
def get_reqs(which="main"):
    """"""
    reqs = []
    for req in all_reqs[which]:
        req_str = req + ">=" + ver_tuple_to_str(min_versions[req])
        if req in version_strictly:
            req_str += ",<" + ver_tuple_to_str(min_versions[req][:-1]) + "." + str(min_versions[req][-1] + 1)
        reqs.append(req_str)
    return reqs