Commit c83ad5e5 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis

astakosclient: Fallback to json module

If 'simplejson' module is not available fallback to 'json'.
parent 3a4db0d3
......@@ -20,10 +20,14 @@ Astakos Client utility module
from httplib import HTTPConnection, HTTPSConnection
from contextlib import closing
import simplejson
from objpool.http import PooledHTTPConnection
from astakosclient.errors import AstakosClientException, BadValue
try:
import simplejson as json
except ImportError:
import json
def retry_dec(func):
"""Class Method Decorator"""
......@@ -81,7 +85,7 @@ def scheme_to_class(scheme, use_pool, pool_size):
def parse_request(request, logger):
"""Parse request with simplejson to convert it to string"""
try:
return simplejson.dumps(request)
return json.dumps(request)
except Exception as err:
msg = "Cannot parse request \"%s\" with simplejson: %s" \
% (request, str(err))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment