-
Notifications
You must be signed in to change notification settings - Fork 21
Description
``
from csvparser import *
from pyjsonq import JsonQ
channel_list_by_type,channel_list,channel_catagory_list =parse_csv_to_json()
qe =JsonQ(data={"channel_list":channel_list})
res = qe.at('channel_list').where('Channel_type', '=',"Movies Hindi").get()
print(res)
print("len =",len(res))
qe =JsonQ(data={"channel_list":channel_list})
res = qe.at('channel_list').where('Channel_type', '=',"MARATHI").get()
print(res)
print("len =",len(res))
out put
[{'sl_no': 41, 'Channel_type': 'Movies Hindi', 'language': 'Hindi', 'FIREBASE_ID': '41', 'package': '', 'quality': 'SD', 'popularity': 75, 'channel_price': '0', 'is_premium': '0', 'channel_name': 'B4U Movies', 'free': True, 'img_url': ''}, , {'sl_no': 72, 'Channel_type': 'Movies Hindi', 'language': 'Hindi', 'FIREBASE_ID': '72', 'package': '', 'quality': 'HD', 'popularity': 72, 'channel_price': '19', 'is_premium': '1', 'channel_name': 'ZEE Cinema HD', 'free': False, 'img_url': ''}]
('len =', 32)
Traceback (most recent call last):
File "/home/mahesh/firebase/wowd2h/jsonpersing.py", line 10, in
res = qe.at('channel_list').where('Channel_type', '=',"MARATHI").get()
File "/home/mahesh/firebase/wowd2h/.env/local/lib/python2.7/site-packages/pyjsonq/query.py", line 113, in at
self._json_data = self.__get_value_from_data(leaf, self._json_data)
File "/home/mahesh/firebase/wowd2h/.env/local/lib/python2.7/site-packages/pyjsonq/query.py", line 78, in __get_value_from_data
raise KeyError("Key not exists")
KeyError: 'Key not exists'
Process finished with exit code 1
but key "MARATHI" present in json