Have you created a user in TVHeadend (it might need admin ticked, and access via network 127.0.0.1/32)? I have one called 'json' and then a password in passwords set also to 'json' for user 'json'. Then on line 27 and 28 in tvh-json.py you need to put that user/pass -
TVH_USER=env('TVH_USER', 'json') TVH_PASS=env('TVH_PASS', 'json')
You might need to change the line below from ('TVH_AUTH', 'digest') to ('TVH_AUTH', 'plain') depending on your TVHeadend version/settings too if it still doesn't work.