(self, http=None)
Save a previously requested `RemoteObject` back to its remote
        resource through an HTTP ``PUT`` request.

        Optional `http` parameter is the user agent object to use. `http`
        objects should be compatible with `httplib2.Http` objects.
Save a previously requested `RemoteObject` back to its remote
        resource through an HTTP ``PUT`` request.
Save a previously requested RemoteObject back to its remote resource through an HTTP PUT request .
def put(self, http=None):
        """Save a previously requested `RemoteObject` back to its remote
        resource through an HTTP ``PUT`` request.

        Optional `http` parameter is the user agent object to use. `http`
        objects should be compatible with `httplib2.Http` objects.

        """
        if getattr(self, '_location', None) is None:
            raise ValueError('Cannot save %r with no URL to PUT to' % self)

        body = json.dumps(self.to_dict(), default=omit_nulls)

        headers = {}
        if hasattr(self, '_etag') and self._etag is not None:
            headers['if-match'] = self._etag
        headers['content-type'] = self.content_types[0]

        request = self.get_request(method='PUT', body=body, headers=headers)
        if http is None:
            http = userAgent
        response, content = http.request(**request)

        log.debug('Yay saved my obj, now turning %r into new content', content)
        self.update_from_response(self._location, response, content)
def put ( self , http = None ) : if getattr ( self , '_location' , None ) is None : raise ValueError ( 'Cannot save %r with no URL to PUT to' % self ) body = json . dumps ( self . to_dict ( ) , default = omit_nulls ) headers = { } if hasattr ( self , '_etag' ) and self . _etag is not None : headers [ 'if-match' ] = self . _etag headers [ 'content-type' ] = self . content_types [ 0 ] request = self . get_request ( method = 'PUT' , body = body , headers = headers ) if http is None : http = userAgent response , content = http . request ( * * request ) log . debug ( 'Yay saved my obj, now turning %r into new content' , content ) self . update_from_response ( self . _location , response , content )