def add_client(self): conn = openerplib.get_connection(hostname=self.config.host, protocol=self.config.protocol, port=self.config.port, database=self.config.database, login=self.config.user, password=self.config.password) try: ping_odoo(conn) except Exception, e: logger.warn('Could not ping Odoo (%s), e:`%s`', self.config.name, format_exc(e))
def handle(self): with closing(self.odb.session()) as session: item = session.query(OutgoingOdoo).filter_by(id=self.request.input.id).one() with self.outgoing.odoo[item.name].conn.client() as client: start_time = time() ping_odoo(client) response_time = time() - start_time self.response.payload.info = 'Ping OK, took:`{0:03.4f} s`'.format(response_time)