def from_host_port(cls, host, port, station_id=None): proxy = xmlrpcutil.LockedTimeoutProxy( 'http://%s:%s' % (host, port), allow_none=True) try: station_info = StationInfo(**proxy.get_station_info()) if station_id and station_info.station_id != station_id: _LOG.warning('Actual Station ID (%s) does not match configured (%s).', station_info.station_id, station_id) except socket.error: station_info = StationInfo(station_id) return cls(host, port, station_info, proxy)
def make_proxy(self, timeout_s=5): """Make a new ServerProxy for this station.""" return xmlrpcutil.LockedTimeoutProxy( 'http://%s:%s' % (self.host, self.station_api_port), timeout_s=timeout_s, allow_none=True)