(self, request, key)
return json.dumps({'meta': content['meta']})
Set a metadata item.  The body must look like:

        ``{"meta": {<key>: value}}``

        although

        ``{"meta": {<key>: value}, "other": "garbage", "keys": "included"}``

        is ok too.

        All the response messages and codes have been verified as of
        2015-04-23 against Rackspace Nova.
Set a metadata item.  The body must look like:
Set a metadata item . The body must look like :
def set_metadata_item(self, request, key):
        """
        Set a metadata item.  The body must look like:

        ``{"meta": {<key>: value}}``

        although

        ``{"meta": {<key>: value}, "other": "garbage", "keys": "included"}``

        is ok too.

        All the response messages and codes have been verified as of
        2015-04-23 against Rackspace Nova.
        """
        try:
            content = json_from_request(request)
        except ValueError:
            request.setResponseCode(400)
            return json.dumps(bad_request("Malformed request body", request))

        # more than one key is ok, non-"meta" keys are just ignored
        if 'meta' not in content or not isinstance(content['meta'], dict):
            return json.dumps(bad_request("Malformed request body", request))

        if len(content['meta']) > 1:
            return json.dumps(bad_request(
                "Request body contains too many items", request))

        if key not in content['meta']:
            return json.dumps(bad_request(
                "Request body and URI mismatch", request))

        try:
            self._server.set_metadata_item(key, content['meta'][key])
        except BadRequestError as e:
            return json.dumps(bad_request(e.nova_message, request))
        except LimitError as e:
            return json.dumps(forbidden(e.nova_message, request))

        # no matter how many keys were passed in, only the meta key is
        # returned
        return json.dumps({'meta': content['meta']})
def set_metadata_item ( self , request , key ) : try : content = json_from_request ( request ) except ValueError : request . setResponseCode ( 400 ) return json . dumps ( bad_request ( "Malformed request body" , request ) ) # more than one key is ok, non-"meta" keys are just ignored if 'meta' not in content or not isinstance ( content [ 'meta' ] , dict ) : return json . dumps ( bad_request ( "Malformed request body" , request ) ) if len ( content [ 'meta' ] ) > 1 : return json . dumps ( bad_request ( "Request body contains too many items" , request ) ) if key not in content [ 'meta' ] : return json . dumps ( bad_request ( "Request body and URI mismatch" , request ) ) try : self . _server . set_metadata_item ( key , content [ 'meta' ] [ key ] ) except BadRequestError as e : return json . dumps ( bad_request ( e . nova_message , request ) ) except LimitError as e : return json . dumps ( forbidden ( e . nova_message , request ) ) # no matter how many keys were passed in, only the meta key is # returned return json . dumps ( { 'meta' : content [ 'meta' ] } )