"不准法"在Python功能瓶功能、QUOT、Python

由网友(自讨苦吃)分享简介:我要保存在.ttl文件中的类型从JavaScript函数'人'的资源:I want to save on a .ttl file a type 'person' resource from a javascript function:这是我的SPARQL查询:this is my sparql query:@a...

我要保存在.ttl文件中的类型从JavaScript函数'人'的资源:

I want to save on a .ttl file a type 'person' resource from a javascript function:

这是我的SPARQL查询:

this is my sparql query:

@app.route('/registraAnnotatore/<author>+<mail>', methods=['POST'])
    def registraAnnotatore(author,mail):
    sparql = SPARQLWrapper("http://localhost:3030/data/update")
    mailto = "<mailto:"+mail+">"
    sparql.setQuery("""
        PREFIX  aop: <http://vitali.web.cs.unibo.it/AnnOtaria/person/>
        PREFIX  foaf: <http://xmlns.com/foaf/0.1/>
        PREFIX  schema: <http://schema.org/>

    INSERT DATA
    { """+mailto+""" a foaf:Person;
      foaf:name """+author+""";
      schema:email """+mail+""".
    }

     """)
    sparql.setReturnFormat(JSON)
    results = sparql.query().convert()
    results = results['results']['bindings']
    results = json.dumps(results)

    return results 

这是我与Ajax调用javascript函数:

and this is my javascript function with the ajax call:

 function salvaRemoto(){

    $.ajax({
     method: 'GET',
     url: '/verificaAnnotatore/'+fullname+'+'+email,
     success: function(d) {
     d = JSON.parse(d);
     alert(d.length);
     if(d.length>0){
         }else{
     //registrazione nuovo utente
     $.ajax({
        method: 'POST',
        url: '/registraAnnotatore/'+fullname+'+'+email,
        success: function() {   
        alert("Utente registrato !!!");

        },
        error: function(a,b,c) {

        alert(a + ' ' + b + ' ' + c);
       }
      });
     } 

    },
    error: function(a,b,c) {
    alert(a + ' ' + b + ' ' + c);
    }
   }); 
  }

我不知道为什么它不工作,任何想法?

I don't know why it doesnt' work, any ideas?

推荐答案

您端点只接受POST请求: @ app.route('/ registraAnnotatore /&LT;笔者&GT; +&LT;邮箱&GT;',方法= ['POST'])和你的客户,你正在做一个GET请求方法:GET,

Your endpoint only accepts POST request: @app.route('/registraAnnotatore/<author>+<mail>', methods=['POST']) and in your client you are doing a GET request method: 'GET',

这就是为什么你得到405不允许的方法该端点(/ registraAnnotatore /&LT ;作者&GT; +&LT;邮箱&GT; )。

That's why you're getting 405 METHOD NOT ALLOWED for this endpoint ( /registraAnnotatore/<author>+<mail>).

阅读全文

相关推荐

最新文章