json: Replace most use of simplejson with json.

This is progress towards removing simplejson as a dependency.
This commit is contained in:
Tim Abbott 2017-10-11 22:54:25 -07:00
parent f8b103bd98
commit 6176d0fbca
4 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
import os
import simplejson
import json
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'api'))
import zulip
@ -11,7 +11,7 @@ zulip_client = zulip.Client(site="http://localhost:9991", client="ZulipGithubPay
payload_dir = "zerver/fixtures/github"
for filename in os.listdir(payload_dir):
with open(os.path.join(payload_dir, filename)) as f:
req = simplejson.loads(f.read())
req = json.loads(f.read())
req['api-key'] = zulip_client.api_key
req['email'] = zulip_client.email
zulip_client.do_api_query(req, zulip.API_VERSTRING + "external/github")

View File

@ -18,7 +18,7 @@ import subprocess
from six.moves import range
import requests
import simplejson as json
import json
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'

View File

@ -1,7 +1,7 @@
from typing import Callable, Text, Union, Optional, Dict, Any, List, Tuple
import os
import simplejson as json
import ujson
from django.http import HttpRequest, HttpResponse
@ -445,7 +445,7 @@ def about_view(request):
# type: (HttpRequest) -> HttpResponse
with open(settings.CONTRIBUTORS_DATA) as f:
data = json.load(f)
data = ujson.load(f)
return render(
request,

View File

@ -54,7 +54,7 @@ import time
import datetime
import logging
import requests
import simplejson
import ujson
from six.moves import cStringIO as StringIO
import re
import importlib
@ -316,7 +316,7 @@ class ErrorReporter(QueueProcessingWorker):
'forward_error',
method='POST',
url='deployments/report_error',
make_request=(lambda type, report: {'type': type, 'report': simplejson.dumps(report)}),
make_request=(lambda type, report: {'type': type, 'report': ujson.dumps(report)}),
)
QueueProcessingWorker.start(self)