问题
I'm trying to filter out the field "name" to store in a file. I'm filtering like so:
r =requests.get('https://api.spotify.com/v1/albums/70yMNdgyIj9SrQXFmdJKx9',
headers=headers)
print(jq(".[name]").transform(json.loads(r)))
I get the error: print(jq(".[name]").transform(text=r)) TypeError: 'module' object is not callable
Any help on the matter? The documentation for jq python bindings is not very clear to me https://pypi.org/project/jq/
回答1:
As the exception message states, you are trying to call a module.
You have probably used import jq
instead of from jq import jq
.
来源:https://stackoverflow.com/questions/49976488/filtering-json-from-api-through-jq-in-python