JSON data
与Pythonrequest.params
的对接:
http://localhost:8000/api/physicalservertask/list_for_home_workpanel/?has_physicalserver=false
如您所见,我在url
中添加了has_physicalserver
参数,它应该是逻辑上的'true',逻辑上的'false',但是在我的Django API中,我得到了一个str
。你知道吗
has_physicalserver_list = query_params.pop('has_physicalserver')
has_physicalserver = has_physicalserver_list[0] if (isinstance(has_physicalserver_list, list) and len(has_physicalserver_list) > 0) else ''
查询参数是字符串。您可以使用
json
解析它。你知道吗相关问题 更多 >
编程相关推荐