def __init__(self, protocol, host, port, product, endpoint, auto_handle_connection=True, session_token=None): # Import only if necessary; some tests may not add this to PYTHONPATH. from codeCheckerDBAccess_v6 import codeCheckerDBAccess from codeCheckerDBAccess_v6.constants import MAX_QUERY_SIZE from libcodechecker.libclient.credential_manager \ import SESSION_COOKIE_NAME self.max_query_size = MAX_QUERY_SIZE url = util.create_product_url( protocol, host, port, '/' + product + '/v' + VERSION + endpoint) print("Setup viewer client: " + url) transport = THttpClient.THttpClient(url) protocol = TJSONProtocol.TJSONProtocol(transport) client = codeCheckerDBAccess.Client(protocol) if session_token: headers = {'Cookie': SESSION_COOKIE_NAME + '=' + session_token} transport.setCustomHeaders(headers) super(CCViewerHelper, self).__init__(transport, client, auto_handle_connection)
def __init__(self, protocol, host, port, uri, session_token=None): self.__host = host self.__port = port url = util.create_product_url(protocol, host, port, uri) self.transport = THttpClient.THttpClient(url) self.protocol = TJSONProtocol.TJSONProtocol(self.transport) self.client = codeCheckerDBAccess.Client(self.protocol) if session_token: headers = {'Cookie': SESSION_COOKIE_NAME + '=' + session_token} self.transport.setCustomHeaders(headers)