

def put(self, *args):
    if ((not self.api_key.can_create_user()) and (self.key_username != args[0])):
        raise HTTPError(403)
    obj = json.loads(self.request.body.decode('utf-8'))
    if (obj.get('key', None) is None):
        raise HTTPError(400)
    try:
        self.auth_mgr.set_key(args[0], obj['key'])
    except UserNotFound:
        raise HTTPError(404)
    self.write({
        'ok': True,
    })

dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/http_handlers/user.py UserKeydHandler.put/original