ShirtsIO/request.py
def json_parse(self, content):
        """
        Wraps and abstracts content validation and JSON parsing
        to make sure the user gets the correct response.
        
        :param content: The content returned from the web request to be parsed as json
        
        :returns: a dict of the json response
        """
        try:
            data = json.loads(content)
        except ValueError, e:
            return {'meta': { 'status': 500, 'msg': 'Server Error'}, 'response': {"error": "Malformed JSON or HTML was returned."}}
        
        #We only really care about the response if we succeed
        #and the error if we fail
        if 'error' in data:
            return {'meta': { 'status': 400, 'msg': 'Bad Request'}, 'response': {"error": data['error']}}
        elif 'result' in data:
            return data['result']
        else:
            return {}
def json_parse(self, content):
        """
        Wraps and abstracts content validation and JSON parsing
        to make sure the user gets the correct response.
        
        :param content: The content returned from the web request to be parsed as json
        
        :returns: a dict of the json response
        """
        try:
            data = json.loads(content)
        except ValueError, e:
            return {'meta': { 'status': 500, 'msg': 'Server Error'}, 'response': {"error": "Malformed JSON or HTML was returned."}}
        
        #We only really care about the response if we succeed
        #and the error if we fail
        if 'error' in data:
            return {'meta': { 'status': 400, 'msg': 'Bad Request'}, 'response': {"error": data['error']}}
        elif 'result' in data:
            return data['result']
        else:
            return {}
def json_parse ( self , content ) : try : data = json . loads ( content ) except ValueError , e : return { 'meta' : { 'status' : 500 , 'msg' : 'Server Error' } , 'response' : { "error" : "Malformed JSON or HTML was returned." } } #We only really care about the response if we succeed #and the error if we fail if 'error' in data : return { 'meta' : { 'status' : 400 , 'msg' : 'Bad Request' } , 'response' : { "error" : data [ 'error' ] } } elif 'result' in data : return data [ 'result' ] else : return { }
Wraps and abstracts content validation and JSON parsing
        to make sure the user gets the correct response.
        
        :param content: The content returned from the web request to be parsed as json
        
        :returns: a dict of the json response
Wraps and abstracts content validation and JSON parsing to make sure the user gets the correct response . : param content : The content returned from the web request to be parsed as json : returns : a dict of the json response