aioupnp/txupnp/fault.py
Jack Robison c1dad347ec
more
2018-07-28 22:08:24 -04:00

13 lines
334 B
Python

from txupnp.util import flatten_keys
from txupnp.constants import FAULT, CONTROL
class UPnPError(Exception):
pass
def handle_fault(response):
if FAULT in response:
fault = flatten_keys(response[FAULT], "{%s}" % CONTROL)
raise UPnPError(fault['detail']['UPnPError']['errorDescription'])
return response