【发布时间】:2020-03-13 12:35:53
【问题描述】:
我正在尝试以某种方式发出获取请求以测试 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}\'')
【问题讨论】: