Consistently use simplejson to loading and dumping JSON. (#2817)

* Consistently use simplejson to loading and dumping JSON.

This introduces the new functions redash.utils.json_dumps and redash.utils.json_loads and simplifies the custom encoder setup.

UUIDs are now handled by the default encoder, too.

Fixes #2807.

Use string comparison in parse_boolean instead of the (simple)json module.
This commit is contained in:
Jannis Leidel
2018-10-09 15:38:06 +02:00
committed by GitHub
parent 5ffc85c066
commit c2429e92d2
62 changed files with 280 additions and 321 deletions

View File

@@ -1,10 +1,10 @@
from __future__ import print_function
import os
import sys
import json
import re
import subprocess
import requests
import simplejson
github_token = os.environ['GITHUB_TOKEN']
auth = (github_token, 'x-oauth-basic')
@@ -17,7 +17,7 @@ def _github_request(method, path, params=None, headers={}):
url = path
if params is not None:
params = json.dumps(params)
params = simplejson.dumps(params)
response = requests.request(method, url, data=params, auth=auth)
return response