Be flexible where simplejson comes from
This commit is contained in:
@@ -25,11 +25,20 @@ import httplib2
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import simplejson
|
||||
import uritemplate
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
try:
|
||||
import simplejson
|
||||
except ImportError:
|
||||
try:
|
||||
# Try to import from django, should work on App Engine
|
||||
from django.utils import simplejson
|
||||
except ImportError:
|
||||
# Should work for Python2.6 and higher.
|
||||
import json as simplejson
|
||||
|
||||
|
||||
class HttpError(Exception):
|
||||
pass
|
||||
|
||||
@@ -23,9 +23,19 @@ __author__ = 'jcgregorio@google.com (Joe Gregorio)'
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import simplejson
|
||||
import sys
|
||||
|
||||
try:
|
||||
import simplejson
|
||||
except ImportError:
|
||||
try:
|
||||
# Try to import from django, should work on App Engine
|
||||
from django.utils import simplejson
|
||||
except ImportError:
|
||||
# Should work for Python2.6 and higher.
|
||||
import json as simplejson
|
||||
|
||||
|
||||
def main():
|
||||
for filename in sys.argv[1:]:
|
||||
f = file(filename, "r")
|
||||
@@ -49,4 +59,3 @@ def main():
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user