def showLogs(logLevel=7, color=True): """ A contextmanager that returns a usable logger that is configured to log debug output. """ from OPSI.Logger import Logger logger = Logger() logLevelBefore = logger.getConsoleLevel() # We might want to have a better log format: # logger.setLogFormat(u'[%l] [%D] %M (%F|%N)') try: logger.setConsoleLevel(logLevel) logger.setConsoleColor(color) yield logger finally: logger.setConsoleLevel(logLevelBefore)
#jsonrpc1 = JSONRPC(jsonrpcBackend = be, baseUrl = be._baseUrl, method = 'authenticated', params = [], retry = False) be.authenticated().setCallback(callback) #jsonrpc2 = JSONRPC(jsonrpcBackend = be, baseUrl = be._baseUrl, method = 'group_getIdents', params = [], retry = False) be.group_getIdents().setCallback(callback) #jsonrpc3 = JSONRPC(jsonrpcBackend = be, baseUrl = be._baseUrl, method = 'host_getIdents', params = [], retry = False) be.host_getIdents().setCallback(callback) be.host_getIdents().setCallback(callback) be.host_getIdents().setCallback(callback) be.host_getIdents().setCallback(callback) be.host_getIdents().setCallback(callback) be.setAsync(False) print("===", be.host_getIdents()) be.backend_exit() def main(): checkIfMultipleCallsSucceed() checkIfConnectionWithCertWorks() checkAsynchronosProcessing() if __name__ == '__main__': logger.setConsoleLevel(LOG_INFO) logger.setConsoleColor(True) main()
}) LOGGER.notice(resp.data) resp = pool.urlopen('GET', url='/www/home/index.html', body=None, headers={ "accept": "text/html", "user-agent": "test" }) LOGGER.notice(resp.headers) resp = pool.urlopen('GET', url='/www/home/index.html', body=None, headers={ "accept": "text/html", "user-agent": "test" }) LOGGER.notice(resp.data) LOGGER.notice(resp.headers) LOGGER.notice(resp.status) LOGGER.notice(resp.version) LOGGER.notice(resp.reason) LOGGER.notice(resp.strict) if __name__ == '__main__': LOGGER.setConsoleLevel(LOG_DEBUG) LOGGER.setConsoleColor(True) main()