class _UPnP3: def __init__(self): self.u = UPnPPlatformIndependent() def test(self): try: self.u.discover() return self.u.found_wanted_services() except: if DEBUG: print_exc() return False def open(self,ip,p,iproto='TCP'): """ Return False in case of network failure, Raises UPnPError in case of a properly reported error from the server """ try: self.u.add_port_map(ip,p,iproto=iproto) return True except UPnPError,e: if DEBUG: print_exc() raise e except:
class _UPnP3: def __init__(self): self.u = UPnPPlatformIndependent() def test(self): try: self.u.discover() return self.u.found_wanted_services() except: if DEBUG: print_exc() return False def open(self, ip, p, iproto='TCP'): """ Return False in case of network failure, Raises UPnPError in case of a properly reported error from the server """ try: self.u.add_port_map(ip, p, iproto=iproto) return True except UPnPError, e: if DEBUG: print_exc() raise e except: