vvaezian / metabase_api_python

A python wrapper for Metabase API
MIT License
136 stars 40 forks source link

NameError: name 'null' is not defined in get_card_data if chosen format is json #20

Closed chlebovec closed 3 years ago

chlebovec commented 3 years ago

I am getting error when trying to use method get_card_data with chosing data format 'json'

Traceback (most recent call last): File "<input>", line 1, in <module> File "/usr/local/lib/python3.9/site-packages/metabase_api/metabase_api.py", line 837, in get_card_data return eval(res.text) File "<string>", line 2, in <module> NameError: name 'null' is not defined

Seems like eval() does not like 'null', maybe using of json.loads() instead could help.

vvaezian commented 3 years ago

@chlebovec Thanks for the bug report. I'll fix it soon.

vvaezian commented 3 years ago

Fixed in 0.2.12

chlebovec commented 3 years ago

@vvaezian there is the same problem with 'true' and 'false' (with lowercase letters at the beginning)... why dont you use json.loads() instead of replacing?

vvaezian commented 3 years ago

@chlebovec Thanks for the suggestion. json.loads() is now used (v.0.2.13).