我正在尝试以某种方式获取针对Eve测试烧瓶客户端的请求:
@pytest.fixture(scope='session')
def client():
app = a.create_app()
app.debug = True
client = app.test_client()
return client
def animal_mes_id(client):
#res = client.get('/my_col?where={"_name": "animal"}')
res = client.get('/my_col', query_string={"_name": "animal"})
print(res.data)
return res.data......['_id'] # Schematic way to show I just want to get the _id
我在以下任一行中都无法使用另一种方法,也不能使用其他方法
#res = client.get('/my_col?where={"_name": "animal"}')
res = client.get('/my_col', query_string={"_name": "animal"})
直接通过--data-urlencode 'projection={"_id": 1}'
documented
我尝试过类似的事情:
client.get('/my_col?where={"_name": "animal"} --data-urlencode \'projection={"_id": 1}\'')
没关系,对我如此愚蠢。在进一步阅读文档后,我发现了它:
这是解决方案:
res = client.get('/my_col', query_string='where={"_name": "animal"}&projection={"_id": 1}')