update Response object from given http response
552409
public void updateResponse() {
        // TODO: update logging
        setStatus(httpResp.getStatusLine().getStatusCode());
        setStatusLine(httpResp.getStatusLine().toString());
        setHeaders(httpResp.getAllHeaders());
        final HttpEntity entity = httpResp.getEntity();
        if (entity != null) {
            try {
                contentBytes = EntityUtils.toByteArray(entity);
            } catch (IOException e) {
                contentBytes = new byte[0]; // empty byte array
                e.printStackTrace();
            }
            ContentType contentType = ContentType.getOrDefault(entity);
            setContentType(contentType);
            setContentLength(entity.getContentLength());
        }
        if(debug)
            System.err.println(this);

    }
171066
def update(self):
        """"""
        response = self.jss.session.post(self.url, data=self.auth)
        response_xml = ElementTree.fromstring(response.text.encode("utf_8"))

        # Remove previous data, if any, and then add in response's XML.
        self.clear()
        for child in response_xml.getchildren():
            self.append(child)
757472
function onResponse( response ) {
		if ( response.statusCode !== 200 ) {
			err = {
				'status': response.statusCode,
				'message': ''
			};
		}
		debug( 'Received a response from query endpoint.' );
		debug( 'Response status: %s.', response.statusCode );
		debug( 'Response headers: %s', JSON.stringify( response.headers ) );

		response.setEncoding( 'utf8' );
		response.on( 'data', onData );
		response.on( 'end', onEnd );
	}
1055773
def _map_response(response, decode=False):
    """"""
    # This causes weird deepcopy errors, so it's commented out for now.
    # item._urllib3_response = response
    item = httplib2.Response(response.getheaders())
    item.status = response.status
    item['status'] = str(item.status)
    item.reason = response.reason
    item.version = response.version

    # httplib2 expects the content-encoding header to be stripped and the
    # content length to be the length of the uncompressed content.
    # This does not occur for 'HEAD' requests.
    if decode and item.get('content-encoding') in ['gzip', 'deflate']:
        item['content-length'] = str(len(response.data))
        item['-content-encoding'] = item.pop('content-encoding')

    return item
378323
def _from_json(cls, response_raw, wrapper=None):
        

        json = response_raw.body_bytes.decode()
        obj = converter.json_to_class(dict, json)
        value = converter.deserialize(
            cls,
            cls._unwrap_response_single(obj, wrapper)
        )

        return client.BunqResponse(value, response_raw.headers)
1019403
def update_response(response)
      @response = response

      unless response.nil?
        @azure_async_operation_header_link = response.headers['Azure-AsyncOperation'] unless response.headers['Azure-AsyncOperation'].nil?
        @location_header_link = response.headers['Location'] unless response.headers['Location'].nil?
      end
    end
808089
def FromResponses(cls, request=None, responses=None):
    """"""
    res = cls()
    res.request = request
    if request:
      res.request_data = request.request_data

    for r in responses or []:
      if isinstance(r, rdf_flow_objects.FlowResponse):
        res.responses.append(r.payload)
      elif isinstance(r, rdf_flow_objects.FlowStatus):
        res.status = r
        res.success = r.status == "OK"
      elif isinstance(r, rdf_flow_objects.FlowIterator):
        pass
      else:
        raise TypeError("Got unexpected response type: %s" % type(r))
    return res
507991
def from_post_response(post_response, content):
        '''
        
        '''
        response = OutcomeResponse()
        response.post_response = post_response
        response.response_code = post_response.status
        response.process_xml(content)
        return response
503461
def from_response(self, response_data):
        ''' 

        '''
        return HSAccessTokenAuth(
            response_data['access_token'],
            response_data['token_type'], 
            response_data['refresh_token'],
            response_data['expires_in'], 
            response_data.get('state') # Not always here
        )
1124770
function reqres(res, req) {
    if (req && req._headers) {
        throw new Error('Received response object where request object was expected');
    }
    this.res = res;
    this.req = req;
    if (res) {
        if (res.$ && res.$.data) {
            this.data = res.$.data;
        }
        else {
            this.data = { error: null };
            if (!res.$) {
                res.$ = this;
            }
        }
    }
}
239450
def update(self, response, **kwargs):
        '''
        
        '''
        response_cls = super(
            LocationResponseClassLegacyAccessor, self)._get_instance(**kwargs)
        if response_cls:
            setattr(response_cls, self.column, self.accessor(response))
            setattr(
                response_cls, self.venue_column, self.venue_accessor(response))
            _action_and_commit(response_cls, session.add)
587487
def from_response(cls, response: 'ClientResponse') -> Any:
        
        obj = cls.response_wrapper_cls(response, cls(response.headers,
                                                     response.content))
        return obj
433596
def _update_state_from_response(self, response_json):
        
        if response_json.get('data') is not None:
            cloud_clock = response_json.get('data')
        else:
            cloud_clock = response_json
        self.parent.json_state = cloud_clock

        cloud_clock_last_reading = cloud_clock.get('last_reading')
        dials = cloud_clock.get('dials')
        for dial in dials:
            if dial.get('object_id') == self.object_id():
                dial['connection'] = cloud_clock_last_reading.get('connection')
                self.json_state = dial
                return True
        return False
928544
def update(self, url, data):
        
        url = self.get_full_url(url)
        self.log.debug("update url : " + url)
        # Building request
        post_data = json.dumps(data).encode("UTF-8")
        request = urllib2.Request(url, post_data)
        request.add_header('Content-Type', 'application/json; charset=UTF-8')
        request.add_header('Accept', 'application/json')
        request.get_method = lambda: 'PUT'
        # Do request
        ret = self.do_request(request)
        self.log.debug("""put url : %(url)s : request time : %(time)s""",
                       {"url": url,
                        "time": self.last_req_time})
        return ret
882697
def update(self):
        '''
        
        '''
        self._json = self._request(
            method='GET',
            url=self.API
        )._json
470590
def parse_response(self, response):
        
        status = response.status_code
        if response.ok:
            data = response.json()
            return HttpResponse(ok=response.ok, status=status, errors=None, data=data)
        else:
            try:
                errors = response.json()
            except ValueError:
                errors = response.content
            return HttpResponse(ok=response.ok, status=status, errors=errors, data=None)
320899
def make_response(obj):
    """"""
    if obj is None:
        raise TypeError("Handler return value cannot be None.")
    if isinstance(obj, Response):
        return obj
    return Response(200, body=obj)