<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def http_request(self, path="/", method="GET", host=None, port=None, json=False, data=None):
 """ perform a HTTP request :param path: str, path within the request, e.g. "/api/version" :param method: str, HTTP method :param host: str, if None, set to 127.0.0.1 :param port: str or int, if None, set to 8080 :param json: bool, should we expect json? :param data: data to send (can be dict, list, str) :return: dict """


        host = host or '127.0.0.1'
        port = port or 8080
        url = get_url(host=host, port=port, path=path)

        return self.http_session.request(method, url, json=json, data=data)