Rewrite json parsing code + use urllib.request in place to curl