终结点查询字符串参数中有多个 "where clauses"
Multiple "where clauses" in endpoint query string parameters
我可以在端点查询字符串中包含多个 "where" 子句(或 AND 运算符)吗?我想做这样的事情:
http://localhost:5000/regions?where=name=="El Salvador"&where=lang=="es"
我尝试了几种不同的语法,但我无法让它工作。
这可能吗?我知道我可以使用 MongoDB 语法,但我想使用 Python 语法。
注意:我不是在尝试使用 python 连接参数列表,我是在尝试使用 Eve's filtering feature 使用本机 python 语法。
Querystring Array Parameters in Python using Requests
看起来像你想要的。如果您使用 '&' 语法,则不需要 where 子句,因此您的子句应如下所示
http://localhost:5000/regions?name=='El Salvador'&lang=='es'
你试过了吗http://localhost:5000/regions?where=name=="El Salvador"%20and%20lang=="es"
?
如果URL
中的space
不起作用,您可以将%20
替换为%20
。在我的邮递员环境中,两种方式都有效。
似乎可以像您想要的那样工作 AND
。 documentation 提到了它,但它遗漏了一个我认为的例子。注意双引号的正确位置。
我可以在端点查询字符串中包含多个 "where" 子句(或 AND 运算符)吗?我想做这样的事情:
http://localhost:5000/regions?where=name=="El Salvador"&where=lang=="es"
我尝试了几种不同的语法,但我无法让它工作。
这可能吗?我知道我可以使用 MongoDB 语法,但我想使用 Python 语法。
注意:我不是在尝试使用 python 连接参数列表,我是在尝试使用 Eve's filtering feature 使用本机 python 语法。
Querystring Array Parameters in Python using Requests
看起来像你想要的。如果您使用 '&' 语法,则不需要 where 子句,因此您的子句应如下所示
http://localhost:5000/regions?name=='El Salvador'&lang=='es'
你试过了吗http://localhost:5000/regions?where=name=="El Salvador"%20and%20lang=="es"
?
如果URL
中的space
不起作用,您可以将%20
替换为%20
。在我的邮递员环境中,两种方式都有效。
似乎可以像您想要的那样工作 AND
。 documentation 提到了它,但它遗漏了一个我认为的例子。注意双引号的正确位置。