Python web 模块,data() 实例源码

我们从Python开源项目中,提取了以下49个代码示例,用于说明如何使用web.data()

项目:webapi    作者:IntPassion    | 项目源码 | 文件源码
def DELETE(self):
        input_data = web.data()
        data = urlparse.parse_qs(input_data)
        v_ct_fids = db.query("select distinct a.value from t_ci_attribute a where a.endtime = $endtime and a.family_id = $fid ",vars={'endtime':ENDTIME,'fid':data['fid'][0]})
        json_en = demjson.encode(v_ct_fids)
        json_de = demjson.decode(json_en)
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num == 0:
            return 2 #there are no records to delete in table T_CI_ATTRIBUTE
        elif v_ct_fid_num > 1:
            return 3 #there are more than one records to delete in table T_CI_ATTRIBUTE

        v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
        #delete t_ci_attribute
        n = fn_delete_ciattr(data['fid'][0],v_curtime,data['change_log'][0])
        return n
项目:webapi    作者:IntPassion    | 项目源码 | 文件源码
def DELETE(self):
        input_data = web.data()
        data = urlparse.parse_qs(input_data)        
        v_ct_fids = db.query("SELECT distinct c.name FROM t_ci_attribute_type c WHERE  c.family_id = $fid and c.endtime = $endtime",vars={'fid':data['fid'][0],'endtime':ENDTIME})
        json_en = demjson.encode(v_ct_fids)
        json_de = demjson.decode(json_en)
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num == 0:
            return 2 #There are no records to delete in table t_ci_attribute_type
        elif v_ct_fid_num > 1:
            return 3 #There are more than one records to delete in table t_ci_attribute_type

        v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
        #When deleting t_ci_attribute_type, we should delete all the relative attribute
        n = fn_delete_ci_attrtype(data['fid'][0],v_curtime,data['change_log'][0])
        return n
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def GET(self, scope, name):
        """ List all parents of a data identifier.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 InternalError

        :returns: A list of dictionary containing all dataset information.
        """
        header('Content-Type', 'application/x-json-stream')
        try:
            for dataset in list_parent_dids(scope=scope, name=name):
                yield render_json(**dataset) + "\n"
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)
项目:Weixin-Backstage    作者:liyouvane    | 项目源码 | 文件源码
def GET(self):
        #??????
        data = web.input()
        signature=data.signature
        timestamp=data.timestamp
        nonce=data.nonce
        echostr=data.echostr
        #???token
        token="YourToken" #????????????????token
        #?????
        list=[token,timestamp,nonce]
        list.sort()
        sha1=hashlib.sha1()
        map(sha1.update,list)
        hashcode=sha1.hexdigest()
        #sha1????        

        #??????????????echostr
        if hashcode == signature:
            return echostr
项目:wxpytest    作者:loveQt    | 项目源码 | 文件源码
def GET(self):
        #??????
        data = web.input()
        signature=data.signature
        timestamp=data.timestamp
        nonce=data.nonce
        echostr = data.echostr
        #???token
        token="wxpytest" #????????????????token
        #?????
        list=[token,timestamp,nonce]
        list.sort()
        sha1=hashlib.sha1()
        map(sha1.update,list)
        hashcode=sha1.hexdigest()
        #sha1????

        #??????????????echostr
        if hashcode == signature:
            return echostr
项目:birdnet    作者:cyysu    | 项目源码 | 文件源码
def GET(self, params):    
    result = None
    headers = self._get_headers()

    target_url = '/' +params 
    if web.ctx.environ.get('QUERY_STRING', None):
      target_url += '?'+web.ctx.environ['QUERY_STRING']
    httpcon = httplib.HTTPConnection('twitter.com', 80)
    try:
      httpcon.request('GET', target_url, headers=headers)
      twitter_response = httpcon.getresponse()
      return self.sendoutput(twitter_response)
    except Exception, inst:
      if result:
        logger.error("%s\n\n%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data(), twitter_response.read()))
      else:
        logger.error("%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data()))
      web.internalerror()
项目:birdnet    作者:cyysu    | 项目源码 | 文件源码
def POST(self, gateway, params):
    result = None
    if gateway not in picture_gateways:
      gateway = 'twitpic'
    ghost, gport, gbaseurl = picture_gateways[gateway]
    target_url = '/' +params 
    headers = self._get_headers()
    httpcon = httplib.HTTPConnection(ghost, gport)
    #logger.debug(str(headers))
    #logger.debug(web.data())
    try:
      httpcon.request('POST', target_url, headers=headers, body=web.data())
      twitter_response = httpcon.getresponse()
      return self.sendoutput(twitter_response)
    except Exception, inst:
      if result:
        logger.error("%s\n\n%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data(), twitter_response.read()))
      else:
        logger.error("%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data()))
      web.internalerror()
项目:birdnet    作者:cyysu    | 项目源码 | 文件源码
def POST(self, gateway, params):
    result = None
    if gateway not in picture_gateways:
      gateway = 'twitpic'
    ghost, gport, gbaseurl = picture_gateways[gateway]
    target_url = '/'+params 
    headers = self._get_headers()
    httpcon = httplib.HTTPConnection(ghost, gport)
    #logger.debug(str(headers))
    #logger.debug(web.data())
    try:
      httpcon.request('POST', gbaseurl+'api/upload', headers=headers, body=web.data())
      twitter_response = httpcon.getresponse()
      return self.sendoutput(twitter_response)
    except Exception, inst:
      if result:
        logger.error("%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, twitter_response.read()))
      else:
        logger.error("%s\n\n%s\n\n%s" % (target_url, str(inst), headers))
      web.internalerror()
项目:vcontrol    作者:CyberReboot    | 项目源码 | 文件源码
def POST(self, o_type):
        web.header('Access-Control-Allow-Origin', self.allow_origin)
        web.header('Access-Control-Allow-Headers', "Content-type")
        data = web.data()
        payload = {}
        try:
            payload = ast.literal_eval(data)
            if type(payload) != dict:
                payload = ast.literal_eval(json.loads(data))
        except:
            return "malformed json body"

        client_session_id = uuid.uuid4().hex
        out = ""
        if o_type == 'a':
            out = self.INDEX_HTML%(client_session_id, payload) + \
                  self.INDEX_HTML_TYPE_A + \
                  self.INDEX_HTML_END
        elif o_type == 'b':
            out = self.INDEX_HTML%(client_session_id, payload) + \
                  self.INDEX_HTML_TYPE_B + \
                  self.INDEX_HTML_END
        return out
项目:vcontrol    作者:CyberReboot    | 项目源码 | 文件源码
def POST(self, machine):
        web.header('Access-Control-Allow-Origin', self.allow_origin)
        data = web.data()
        payload = {}
        try:
            payload = ast.literal_eval(data)
            if type(payload) != dict:
                payload = ast.literal_eval(json.loads(data))
        except:
            return "malformed json body"

        try:
            command = payload['command']
        except:
            out = "you must specify a command"
            return out
        try:
            cmd = "/usr/local/bin/docker-machine ssh "+machine+" \""+command+"\""
            out = subprocess.check_output(cmd, shell=True)
        except:
            out = "unable to execute generic command"
        return str(out)
项目:vcontrol    作者:CyberReboot    | 项目源码 | 文件源码
def POST(self):
        web.header('Access-Control-Allow-Origin', self.allow_origin)
        web.header('Access-Control-Allow-Headers', "Content-type")
        # !! TODO does this work with swagger?
        data = web.data()
        payload = {}
        try:
            payload = ast.literal_eval(data)
            if type(payload) != dict:
                payload = ast.literal_eval(json.loads(data))
        except Exception as e:
            return "malformed json body", str(e)

        try:
            filedir = '/tmp/templates/'+payload['machine']
            if not os.path.exists(filedir):
                os.makedirs(filedir)
            cmd = "docker-machine scp "+payload['machine']+":/var/lib/docker/data/templates/"+payload['template']+" "+filedir
            output = subprocess.check_output(cmd, shell=True)
            f = open(filedir+"/"+payload['template'], 'rb')
            return f.read()
        except Exception as e:
            return "failed to download", str(e)
        return "failed to download", str(e)
项目:vent    作者:CyberReboot    | 项目源码 | 文件源码
def POST():
        """
        Send a POST request with a docker container ID and it will be stopped.

        Example input: {'id': "12345"}, {'id': ["123", "456"]
        """
        web.header('Content-Type', 'application/json')

        # verify user input
        data = web.data()
        payload = {}
        try:
            payload = ast.literal_eval(data)
        except Exception as e:  # pragma: no cover
            return (False, 'malformed payload : ' + str(e))

        # verify payload has a container ID
        if 'id' not in payload:
            return (False, 'payload missing container id')

        # connect to docker and stop the given container
        c = None
        try:
            c = docker.from_env()
        except Exception as e:  # pragma: no cover
            return (False, 'unable to connect to docker because: ' + str(e))

        # stop containers chosen from CLI
        try:
            for container_id in payload['id']:
                c.containers.get(container_id).stop()
        except Exception as e:  # pragma: no cover
            return (False, 'unable to stop list of containers because: ' +
                    str(e))

        return (True, 'container successfully stopped: ' + str(payload['id']))
项目:vent    作者:CyberReboot    | 项目源码 | 文件源码
def POST():
        """
        Send a POST request with a docker container ID and it will be deleted.

        Example input: {'id': "12345"}, {'id': ["123", "456"]}
        """
        web.header('Content-Type', 'application/json')

        # verify user input
        data = web.data()
        payload = {}
        try:
            payload = ast.literal_eval(data)
        except Exception as e:  # pragma: no cover
            return (False, 'malformed payload : ' + str(e))

        # verify payload has a container ID
        if 'id' not in payload:
            return (False, 'payload missing container id')

        # connect to docker and stop the given container
        c = None
        try:
            c = docker.from_env()
        except Exception as e:  # pragma: no cover
            return (False, 'unable to connect to docker because: ' + str(e))

        # delete containers chosen from CLI
        try:
            for container_id in payload['id']:
                c.containers.get(container_id).remove()
        except Exception as e:  # pragma: no cover
            return (False, 'unable to delete containers because: '
                    + str(e))

        return (True, 'container successfully deleted: ' + str(payload['id']))
项目:vent    作者:CyberReboot    | 项目源码 | 文件源码
def POST():
        """
        Send a POST request with a docker container ID and it will be started.

        Example input: {'id': "12345"}, {'id': ["123", "456"]}
        """
        web.header('Content-Type', 'application/json')

        # verify user input
        data = web.data()
        payload = {}
        try:
            payload = ast.literal_eval(data)
        except Exception as e:  # pragma: no cover
            return (False, 'malformed payload : ' + str(e))

        # verify payload has a container ID
        if 'id' not in payload:
            return (False, 'payload missing container id')

        # connect to docker and stop the given container
        c = None
        try:
            c = docker.from_env()
        except Exception as e:  # pragma: no cover
            return (False, 'unable to connect to docker because: ' + str(e))

        # start containers chosen from CLI
        try:
            for container_id in payload['id']:
                c.containers.get(container_id).start()
        except Exception as e:  # pragma: no cover
            return (False, 'unable to start list of containers because: ' +
                    str(e))

        return (True, 'container successfully started: ' + str(payload['id']))
项目:app-scripts    作者:Forkong    | 项目源码 | 文件源码
def GET(self, url):
        r = requests.get(server+url, data=web.input(), headers=web_headers)
        print 'text = ', r.text
        return r.text
项目:app-scripts    作者:Forkong    | 项目源码 | 文件源码
def POST(self, url):
        r = requests.post(server+url, data=web.data(), headers=web.headers)
        print 'text = ', r.text
        return r.text
项目:nupic-history-server    作者:htm-community    | 项目源码 | 文件源码
def POST(self):
    global modelCache
    params = json.loads(web.data())
    requestInput = web.input()
    id = requestInput["id"]
    # We will always return the active cells because they are cheap.
    returnSnapshots = [TM_SNAPS.ACT_CELLS]
    from pprint import pprint; pprint(params)
    tm = TM(**params)

    tmFacade = TmFacade(tm, ioClient, modelId=id)

    modelId = tmFacade.getId()
    modelCache[modelId]["tm"] = tmFacade
    modelCache[modelId]["classifier"] = SDRClassifierFactory.create(implementation="py")
    modelCache[modelId]["recordsSeen"] = 0

    print "Created TM {}".format(modelId)

    payload = {
      "meta": {
        "id": modelId,
        "saving": returnSnapshots
      }
    }

    tmState = tmFacade.getState(*returnSnapshots)

    for key in tmState:
      payload[key] = tmState[key]

    web.header("Content-Type", "application/json")
    return json.dumps(payload)
项目:ciscosparkapi    作者:CiscoDevNet    | 项目源码 | 文件源码
def POST(self):
        """Respond to inbound webhook JSON HTTP POSTs from Cisco Spark."""
        json_data = web.data()                                  # Get the POST data sent from Spark
        print("\nWEBHOOK POST RECEIVED:")
        print(json_data, "\n")

        webhook_obj = Webhook(json_data)                        # Create a Webhook object from the JSON data
        room = api.rooms.get(webhook_obj.data.roomId)           # Get the room details
        message = api.messages.get(webhook_obj.data.id)         # Get the message details
        person = api.people.get(message.personId)               # Get the sender's details

        print("NEW MESSAGE IN ROOM '{}'".format(room.title))
        print("FROM '{}'".format(person.displayName))
        print("MESSAGE '{}'\n".format(message.text))

        # This is a VERY IMPORTANT loop prevention control step.
        # If you respond to all messages...  You will respond to the messages
        # that the bot posts and thereby create a loop condition.
        me = api.people.me()
        if message.personId == me.id:
            # Message was sent by me (bot); do not respond.
            return 'OK'
        else:
            # Message was sent by someone else; parse message and respond.
            if "/CAT" in message.text:
                print("FOUND '/CAT'")
                cat_fact = get_catfact()                                          # Get a cat fact
                print("SENDING CAT FACT '{}'".format(cat_fact))
                response_message = api.messages.create(room.id, text=cat_fact)    # Post the fact to the room where the request was received
        return 'OK'
项目:Python-Plex-Controller    作者:MoeFwacky    | 项目源码 | 文件源码
def getclient(data):
    client = data
    client = client.split("\"Player\":")
    client = client[1]
    client = client.split("},")
    client = client[0]
    client = client.split("title\":\"")
    client = client[1]
    client = client.split("\"")
    client = client[0]
    return (client)
项目:Python-Plex-Controller    作者:MoeFwacky    | 项目源码 | 文件源码
def getaction(data):
    action = data
    action = action.split("event\":\"")
    action = action[1]
    action = action.split("\"")
    action = action[0]
    return action
项目:webapi    作者:IntPassion    | 项目源码 | 文件源码
def DELETE(self):
        input_data = web.data()
        data = urlparse.parse_qs(input_data)
        v_ct_fids = db.query("SELECT distinct c.name FROM t_ci_type c WHERE  c.family_id = $fid and c.endtime = $endtime",
                             vars={'fid':data['fid'][0],'endtime':ENDTIME})
        json_en = demjson.encode(v_ct_fids)
        json_de = demjson.decode(json_en)
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num == 0:
            return 2 #there are no records to delete in table T_CI_TYPE
        elif v_ct_fid_num > 1:
            return 3 #there are more than one records to delete in table T_CI_TYPE
        #Before deleting t_ci_type, we should ensure that there are no relative records in t_ci?t_ci_attribute_type?t_ci_relation_type
        v_num = db.query('select count(*) num from t_ci a where a.type_fid = $fid and a.endtime = $endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
        ci_num = v_num[0]['NUM']
        if ci_num <> 0:
            return 4 #there are relative records in t_ci
        # If there is no relative ci, there will be no relative attribute and relation. Then we can directly delete attribute type and relation type
        # Delete ci_attribute_type
        v_cat_fids = db.query('select distinct a.family_id from t_ci_attribute_type a where a.ci_type_fid = $fid and a.endtime = $endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
        json_en = demjson.encode(v_cat_fids)
        json_de = demjson.decode(json_en)
        v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num <> 0:
            for v_cat_fid in json_de:
                n = webci_attr_type.fn_delete_ci_attrtype(v_cat_fid['FAMILY_ID'], v_curtime, data['change_log'][0])
        #Delete ci_relation_type
        v_crt_fids = db.query('select distinct a.family_id from t_ci_relation_type a where (a.source_type_fid = $fid or a.target_type_fid = $fid) and a.endtime = $endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
        json_en = demjson.encode(v_crt_fids)
        json_de = demjson.decode(json_en)
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num <> 0:
            for v_crt_fid in json_de:
                n = webci_relation_type.fn_delete_ci_relatype(v_crt_fid['FAMILY_ID'], v_curtime, data['change_log'][0])

        #Delete t_ci_type
        n = fn_delete_ci_type(data['fid'][0],v_curtime,data['change_log'][0])
        return n
项目:webapi    作者:IntPassion    | 项目源码 | 文件源码
def DELETE(self):
        input_data = web.data()
        data = urlparse.parse_qs(input_data)
        v_ct_fids = db.query('SELECT distinct c.name FROM t_ci c WHERE  c.family_id = $fid and c.endtime=$endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
        json_en = demjson.encode(v_ct_fids)
        json_de = demjson.decode(json_en)
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num == 0:
            return 2 #there are no records to delete in table t_ci
        elif v_ct_fid_num > 1:
            return 3 #there are more than one records to delete in table t_ci
        #Notice?besides t_ci?information in t_ci_attribute and t_ci_relation should be deleted too
        v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
        n = fn_delete_ci(data['fid'][0],v_curtime,data['change_log'][0])
        return n
项目:webapi    作者:IntPassion    | 项目源码 | 文件源码
def DELETE(self):
        input_data = web.data()
        data = urlparse.parse_qs(input_data)
        v_ct_fids = db.query("select distinct t.source_fid,t.target_fid,t.type_fid,t.owner,t.family_id from t_ci_relation t where t.family_id=$fid and t.endtime=$endtime",vars={'endtime':ENDTIME,'fid':data['fid'][0]})
        json_en = demjson.encode(v_ct_fids)
        json_de = demjson.decode(json_en)
        v_ct_fid_num = len(json_de)
        if v_ct_fid_num == 0:
            return 2 #there is no records to delete in table T_CI_RELATION
        elif v_ct_fid_num > 1:
            return 3 #there are more than one records to delete in table T_CI_RELATION

        v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
        #Notice?if the relation is composition and the target ci exists, we should delete the relative ci
        v_target_fids = db.query("select t.family_id, crt.relation from t_ci t, t_ci_relation_type crt where t.family_id=$target_fid and t.endtime=$endtime and crt.family_id=$type_fid and crt.endtime=$endtime and crt.relation='COMPOSITION'",vars={'endtime':ENDTIME,'target_fid':json_de[0]['TARGET_FID'],'type_fid':json_de[0]['TYPE_FID']})
        target_json_en = demjson.encode(v_target_fids)
        target_json_de = demjson.decode(target_json_en)
        v_target_num = len(target_json_de)
        if v_target_num <> 0:
            #delete the existed ci. It will also delete the relative ci_attribute and ci_relation.
            n = webci.fn_delete_ci(json_de[0]['TARGET_FID'], v_curtime, data['change_log'][0])
        else:
            #delete t_ci_relation
            n = fn_delete_cirela(data['fid'][0],v_curtime,data['change_log'][0])

        return n
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, account):
        """ update the status for a given account name
        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found
            500 InternalError

        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')
        status = parameter.get('status', 'ACTIVE')
        try:
            set_account_status(account, status=status, issuer=ctx.env.get('issuer'))
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Unknown status %s' % status)
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
        except AccountNotFound, e:
            raise generate_http_error(404, 'AccountNotFound', e.args[0][0])
        except Exception, e:
            raise InternalError(e)

        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def DELETE(self, account):

        """ Delete an account's identity mAPPing.

        HTTP Success:
            200 Created

        HTTP Error:
            400 Bad Reqeust
            401 Unauthorized
            404 Not Found
            500 Internal Error
        :param account: Account identifier.
        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')
        try:
            identity = parameter['identity']
            authtype = parameter['authtype']
        except KeyError, e:
            if e.args[0] == 'authtype' or e.args[0] == 'identity':
                raise generate_http_error(400, 'KeyError', '%s not defined' % str(e))
        except TypeError:
            raise generate_http_error(400, 'TypeError', 'body must be a json dictionary')
        try:
            del_account_identity(identity, authtype, account)
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
        except AccountNotFound, e:
            raise generate_http_error(404, 'AccountNotFound', e.args[0][0])
        except IdentityError, e:
            raise generate_http_error(404, 'IdentityError', e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)

        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, rule_id):
        """
        Update the replication rules locked flag .

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found
            500 InternalError
        """
        json_data = data()
        try:
            params = loads(json_data)
            options = params['options']
            update_replication_rule(rule_id=rule_id, options=options, issuer=ctx.env.get('issuer'))
        except AccessDenied as error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except RuleNotFound as error:
            raise generate_http_error(404, 'RuleNotFound', error.args[0][0])
        except AccountNotFound as error:
            raise generate_http_error(404, 'AccountNotFound', error.args[0][0])
        except ScratchDiskLifetimeConflict as error:
            raise generate_http_error(409, 'ScratchDiskLifetimeConflict', error.args[0])
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
        except UnsupportedOperation as error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0])
        except RucioException as error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0])
        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def DELETE(self, rule_id):
        """
        Delete a new replication rule.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found
            500 Internal Error
        """
        json_data = data()
        try:
            purge_replicas = None
            params = loads(json_data)
            if 'purge_replicas' in params:
                purge_replicas = params['purge_replicas']
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            delete_replication_rule(rule_id=rule_id, purge_replicas=purge_replicas, issuer=ctx.env.get('issuer'))
        except AccessDenied as error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except UnsupportedOperation as error:
            raise generate_http_error(401, 'UnsupportedOperation', error.args[0][0])
        except RuleNotFound as error:
            raise generate_http_error(404, 'RuleNotFound', error.args[0][0])
        except Exception, error:
            raise InternalError(error)
        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, account, name):
        """
        Update an existing subscription.

        HTTP Success:
            201 Created

        HTTP Error:
            400 Bad Request
            401 Unauthorized
            404 Not Found
            500 Internal Error
        """
        json_data = data()
        try:
            params = loads(json_data)
            params = params['options']
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        metadata = {}
        metadata['filter'] = params.get('filter', None)
        metadata['replication_rules'] = params.get('replication_rules', None)
        metadata['comments'] = params.get('comments', None)
        metadata['lifetime'] = params.get('lifetime', None)
        metadata['retroactive'] = params.get('retroactive', None)
        metadata['priority'] = params.get('priority', None)
        try:
            update_subscription(name=name, account=account, metadata=metadata, issuer=ctx.env.get('issuer'))
        except (InvalidObject, TypeError) as error:
            raise generate_http_error(400, 'InvalidObject', error[0][0])
        except AccessDenied as error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except SubscriptionNotFound as error:
            raise generate_http_error(404, 'SubscriptionNotFound', error[0][0])
        except RucioException as error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0])
        except Exception as error:
            raise InternalError(error)
        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self):
        """
        Create file replicas at a given RSE.

        HTTP Success:
            201 Created

        HTTP Error:
            401 Unauthorized
            409 Conflict
            500 Internal Error
        """
        json_data = data()
        try:
            parameters = parse_response(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_replicas(rse=parameters['rse'], files=parameters['files'], issuer=ctx.env.get('issuer'), ignore_availability=parameters.get('ignore_availability', False))
        except InvalidPath, e:
            raise generate_http_error(400, 'InvalidPath', e.args[0][0])
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
        except Duplicate, e:
            raise generate_http_error(409, 'Duplicate', e[0][0])
        except DataIdentifierAlreadyExists, e:
            raise generate_http_error(409, 'DataIdentifierAlreadyExists', e[0][0])
        except RSENotFound, e:
            raise generate_http_error(404, 'RSENotFound', e[0][0])
        except ResourceTemporaryUnavailable, e:
            raise generate_http_error(503, 'ResourceTemporaryUnavailable', e[0][0])
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)
        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self):
        """
        Update a file replicas state at a given RSE.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 Internal Error
        """
        json_data = data()
        try:
            parameters = parse_response(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            update_replicas_states(rse=parameters['rse'], files=parameters['files'], issuer=ctx.env.get('issuer'))
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
        except UnsupportedOperation, e:
            raise generate_http_error(500, 'UnsupportedOperation', e.args[0][0])
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)
        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def DELETE(self):
        """
        Delete file replicas at a given RSE.

        HTTP Success:
            200 Ok

        HTTP Error:
            401 Unauthorized
            409 Conflict
            500 Internal Error
        """
        json_data = data()
        try:
            parameters = parse_response(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            delete_replicas(rse=parameters['rse'], files=parameters['files'], issuer=ctx.env.get('issuer'), ignore_availability=parameters.get('ignore_availability', False))
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
        except RSENotFound, e:
            raise generate_http_error(404, 'RSENotFound', e[0][0])
        except ResourceTemporaryUnavailable, e:
            raise generate_http_error(503, 'ResourceTemporaryUnavailable', e[0][0])
        except ReplicaNotFound, e:
            raise generate_http_error(404, 'ReplicaNotFound', e.args[0][0])
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)
        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self):
        """
        List the DIDs associated to a list of replicas.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 InternalError

        :returns: A list of dictionaries containing the mAPPing PFNs to DIDs.
        """
        json_data = data()
        rse, pfns = None, []
        header('Content-Type', 'application/x-json-stream')
        rse = None
        try:
            params = parse_response(json_data)
            if 'pfns' in params:
                pfns = params['pfns']
            if 'rse' in params:
                rse = params['rse']
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            for pfn in get_did_from_pfns(pfns, rse):
                yield dumps(pfn) + '\n'
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self):
        """
        Declare a list of bad replicas.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 InternalError

        """
        json_data = data()
        pfns = []
        header('Content-Type', 'application/x-json-stream')
        try:
            params = parse_response(json_data)
            if 'pfns' in params:
                pfns = params['pfns']
            if 'reason' in params:
                reason = params['reason']
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        not_declared_files = {}
        try:
            not_declared_files = declare_bad_file_replicas(pfns=pfns, reason=reason, issuer=ctx.env.get('issuer'))
        except ReplicaNotFound, e:
            raise generate_http_error(404, 'ReplicaNotFound', e.args[0][0])
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)
        raise Created(dumps(not_declared_files))
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self, key):
        """
        Create a new value for a key.

        HTTP Success:
            201 Created

        HTTP Error:
            401 Unauthorized
            404 Not Found
            409 Conflict
            500 Internal Error

        :param Rucio-Auth-Account: Account identifier.
        :param Rucio-Auth-Token: as an 32 character hex string.
        :params Rucio-Account: account belonging to the new scope.
        """
        json_data = data()
        try:
            params = loads(json_data)
            value = params['value']
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_value(key=key, value=value, issuer=ctx.env.get('issuer'))
        except Duplicate, e:
            raise generate_http_error(409, 'Duplicate', e[0][0])
        except InvalidValueForKey, e:
            raise generate_http_error(400, 'InvalidValueForKey', e[0][0])
        except KeyNotFound, e:
            raise generate_http_error(400, 'KeyNotFound', e[0][0])
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print e
            raise InternalError(e)

        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, rse):
        """ Update RSE properties (e.g. name, availability).

        HTTP Success:
            201 Created

        HTTP Error:
            400 Bad request
            401 Unauthorized
            404 Resource not Found
            409 Conflict
            500 Internal Error

        """
        json_data = data()
        kwargs = {}

        try:
            parameters = json_data and loads(json_data)
            kwargs['parameters'] = parameters
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary')
        kwargs['issuer'] = ctx.env.get('issuer')
        try:
            update_rse(rse, **kwargs)
        except InvalidObject, error:
            raise generate_http_error(400, 'InvalidObject', error[0][0])
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except RSENotFound, error:
            raise generate_http_error(404, 'RSENotFound', error.args[0][0])
        except Duplicate, error:
            raise generate_http_error(409, 'Duplicate', error[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print error
            print format_exc()
            raise InternalError(error)

        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self, rse, key):
        """ create rse with given RSE name.

        HTTP Success:
            201 Created

        HTTP Error:
            400 Bad request
            401 Unauthorized
            500 Internal Error

        :param rse: RSE name.
        :param key: Key attribute.

        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary')

        try:
            value = parameter['value']
        except KeyError, error:
            raise generate_http_error(400, 'KeyError', '%s not defined' % str(error))

        try:
            add_rse_attribute(rse=rse, key=key, value=value, issuer=ctx.env.get('issuer'))
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except Duplicate, error:
            raise generate_http_error(409, 'Duplicate', error[0][0])
        except Exception, error:
            raise InternalError(error)

        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, rse, scheme, hostname=None, port=None):
        """
        Updates attributes of an existing protocol entry. Because protocol identifier, hostname,
        and port are used as unique identifier they are immutable.

        HTTP Success:
            200 OK

        HTTP Error:
            400 Bad Request
            401 Unauthorized
            404 Resource not Found
            409 Conflict
            500 InternalError
        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary')

        try:
            update_protocols(rse, issuer=ctx.env.get('issuer'), scheme=scheme, hostname=hostname, port=port, data=parameter)
        except InvalidObject, error:
            raise generate_http_error(400, 'InvalidObject', error[0][0])
        except RSEProtocolNotSupported, error:
            raise generate_http_error(404, 'RSEProtocolNotSupported', error[0][0])
        except RSENotFound, error:
            raise generate_http_error(404, 'RSENotFound', error[0][0])
        except RSEProtocolDomainNotSupported, error:
            raise generate_http_error(404, 'RSEProtocolDomainNotSupported', error[0][0])
        except RSEProtocolPriorityError, error:
            raise generate_http_error(409, 'RSEProtocolPriorityError', error[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print error
            print format_exc()
            raise InternalError(error)

        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, rse):
        """ Update RSE usage information.

        HTTP Success:
            200 Updated

        HTTP Error:
            400 Bad Request
            401 Unauthorized
            404 Not Found
            409 Conflict
            500 Internal Error

        :param rse: The RSE name.
        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary')

        try:
            set_rse_usage(rse=rse, issuer=ctx.env.get('issuer'), **parameter)
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except RSENotFound, error:
            raise generate_http_error(404, 'RSENotFound', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)

        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, rse):
        """ Update RSE limits.

        HTTP Success:
            200 Updated

        HTTP Error:
            400 Bad Request
            401 Unauthorized
            404 Not Found
            409 Conflict
            500 Internal Error

        :param rse: The RSE name.
        """
        header('Content-Type', 'application/json')
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary')
        try:
            set_rse_limits(rse=rse, issuer=ctx.env.get('issuer'), **parameter)
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except RSENotFound, error:
            raise generate_http_error(404, 'RSENotFound', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)

        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self):
        json_data = data()
        try:
            dids = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_temporary_dids(dids=dids, issuer=ctx.env.get('issuer'))
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print format_exc()
            raise InternalError(e)
        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self, rse, operation):
        """
        Get URLs for files at a given RSE.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 Internal Error
        """
        header('Content-Type', 'application/json')
        json_data = data()
        try:
            parameters = parse_response(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            result = objectstore.get_signed_urls(parameters, rse=rse, operation=operation)
            for url in result:
                if isinstance(result[url], Exception):
                    raise result[url]
            return render_json(**result)
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print traceback.format_exc()
            raise InternalError(e)
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self, rse):
        """
        Get files metadata at a given RSE.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 Internal Error
        """
        header('Content-Type', 'application/json')
        json_data = data()
        try:
            parameters = parse_response(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            url = parameters['url']
            new_url = parameters['new_url']
            objectstore.rename(url, new_url, rse=rse)
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
        except Exception, e:
            print traceback.format_exc()
            raise InternalError(e)

        raise OK()


# ----------------------
#   Web service startup
# ----------------------
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def GET(self, scope):
        """
        Return all data identifiers in the given scope.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found

        :param scope: The scope name.
        """
        header('Content-Type', 'application/x-json-stream')
        name = None
        recursive = False
        if ctx.query:
            params = parse_qs(ctx.query[1:])
            if 'name' in params:
                name = params['name'][0]
            if 'recursive' in params:
                recursive = True

        try:
            for did in scope_list(scope=scope, name=name, recursive=recursive):
                yield render_json(**did) + '\n'
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def GET(self, scope):
        """
        List all data identifiers in a scope which match a given metadata.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 KeyNotFound
            409 UnsupportedOperation

        :param scope: The scope name.
        """

        header('Content-Type', 'application/x-json-stream')
        filters = {}
        long = False
        if ctx.query:
            params = parse_qs(ctx.query[1:])
            for k, v in params.items():
                if k == 'type':
                    type = v[0]
                elif k == 'long':
                    long = bool(v[0])
                else:
                    filters[k] = v[0]

        try:
            for did in list_dids(scope=scope, filters=filters, type=type, long=long):
                yield dumps(did) + '\n'
        except UnsupportedOperation, error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0][0])
        except KeyNotFound, error:
            raise generate_http_error(404, 'KeyNotFound', error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self):
        try:
            json_data = loads(data())
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_dids(json_data, issuer=ctx.env.get('issuer'))
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except DuplicateContent, error:
            raise generate_http_error(409, 'DuplicateContent', error.args[0][0])
        except DataIdentifierAlreadyExists, error:
            raise generate_http_error(409, 'DataIdentifierAlreadyExists', error.args[0][0])
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except UnsupportedOperation, error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0][0])
        except DatabaseException, error:
            raise generate_http_error(500, 'DatabaseException', error.args)
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)
        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self):

        # To be moved in a common processor

        attachments, ignore_duplicate = [], False
        try:
            json_data = loads(data())
            if type(json_data) is dict:
                attachments = json_data.get('attachments')
                ignore_duplicate = json_data.get('ignore_duplicate')
            elif type(json_data) is list:
                attachments = json_data
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            attach_dids_to_dids(attachments=attachments, ignore_duplicate=ignore_duplicate, issuer=ctx.env.get('issuer'))
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except DuplicateContent, error:
            raise generate_http_error(409, 'DuplicateContent', error.args[0][0])
        except DataIdentifierAlreadyExists, error:
            raise generate_http_error(409, 'DataIdentifierAlreadyExists', error.args[0][0])
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except UnsupportedOperation, error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)

        raise Created()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def PUT(self, scope, name):
        """
        Update data identifier status.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 InternalError

        :param scope: data identifier scope.
        :param name: data identifier name.
        """
        json_data = data()
        try:
            kwargs = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json data parameter')

        try:
            set_status(scope=scope, name=name, issuer=ctx.env.get('issuer'), **kwargs)
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except UnsupportedStatus, error:
            raise generate_http_error(409, 'UnsupportedStatus', error.args[0][0])
        except UnsupportedOperation, error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0][0])
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)

        raise OK()
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def GET(self, scope, name):
        """
        Returns the contents of a data identifier.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 InternalError

        :param scope: The scope of the data identifier.
        :param name: The name of the data identifier.

        :returns: A list with the contents.
        """
        header('Content-Type', 'application/x-json-stream')
        try:
            for did in list_content(scope=scope, name=name):
                yield render_json(**did) + '\n'
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)
项目:rucio    作者:rucio01    | 项目源码 | 文件源码
def POST(self, scope, name):
        """
        Append data identifiers to data identifiers.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            500 InternalError

        :param scope: Create the data identifier within this scope.
        :param name: Create the data identifier with this name.
        """
        try:
            json_data = loads(data())
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            attach_dids(scope=scope, name=name, attachment=json_data, issuer=ctx.env.get('issuer'))
        except DataIdentifierNotFound, error:
            raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
        except DuplicateContent, error:
            raise generate_http_error(409, 'DuplicateContent', error.args[0][0])
        except AccessDenied, error:
            raise generate_http_error(401, 'AccessDenied', error.args[0][0])
        except UnsupportedOperation, error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0][0])
        except RSENotFound, error:
            raise generate_http_error(404, 'RSENotFound', error.args[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0])
        except Exception, error:
            print format_exc()
            raise InternalError(error)

        raise Created()