将值从邮递员x-www-form-urlencode编码为flask-restful

时间:2018-12-14 10:02:59

标签: api flask postman flask-restful

在原始发布中,我可以通过以下代码获取JSON的值:

"mappings": {
"person": {
  "properties": {
    "name": { 
      "type": "text",
      "fields": {
        "keyword": { 
          "type": "keyword"
        },
        "words_count": { 
          "type": "token_count",
          "analyzer": "standard"
        },
        "length": { 
          "type": "token_count",
          "analyzer": "character_analyzer"
        }
      }
    }
  }
}
}

我的烧瓶代码:

c# code

Func<QueryContainerDescriptor<MyType>, QueryContainer> query = m => m
                                    .Range(r => r.Field(f => f.name.words_count).Relation(RangeRelation.Within)
                                    .GreaterThanOrEquals(10).LessThanOrEquals(14));

如何在选择[ { "username": "paul", "password": "paul1" }, { "username": "paul2", "password": "paul12" }, { "username": "paul3", "password": "paul14" } ] 的邮递员中发出POST请求?我在邮递员中遇到错误。另外,在选择class CreateUser(Resource): def post(self): try: conn = None json_dict = request.get_json(force=True, silent=True) x = len(json_dict) name = str(json_dict[0]['username']) print(x) return name except Exception as e: x = str(e) x.replace('\n', '') return {'status' : 'failed', 'message' : str(x)} finally: if conn is not None: conn.close() 的情况下,您建议使用什么代码在json中获取多个值?预先感谢。

enter image description here

0 个答案:

没有答案