import requests
import json


class BaseForAPIGW():
    def __init__(self):
        self.base_url = 'http://localhost:80'
        self.api_key_query = ''

    def get_object_from_request(self, resource):
        '''
        To escape the doubled jsonified text,
        it converts the response text to the object.
        '''

        def _get_request_url():
            return self.base_url + resource + self.api_key_query

        text = ''

        try:
            response = requests.get(_get_request_url())
        except requests.ConnectionError:
            text = '{"status": 500, "exception": "ConnectionError"}'
        else:
            text = response.text

        objects = json.loads(text)

        if isinstance(objects, dict):
            server_error_msg = objects.get("message")
            if server_error_msg == "Internal Server Error":
                objects = {"status": 500, "exception": server_error_msg}

        return objects

@@ -705,234 +705,8 @@
 t)%0A%0A
-        if isinstance(objects, dict):%0A            server_error_msg = objects.get(%22message%22)%0A            if server_error_msg == %22Internal Server Error%22:%0A                objects = %7B%22status%22: 500, %22exception%22: server_error_msg%7D%0A%0A
     

remove logic in api gw