forked from CMS/memberPlumbing
DoorController: Check for HTTP error before trying to parse XML
This commit is contained in:
parent
ab6d0bdbc4
commit
2855e773cd
@ -124,9 +124,13 @@ class DoorController:
|
||||
params={"XML": prefix + xml},
|
||||
auth=requests.auth.HTTPDigestAuth(self.username, self.password),
|
||||
)
|
||||
resp_xml = etree.XML(r.content)
|
||||
|
||||
if r.status_code != 200:
|
||||
raise RemoteError(r)
|
||||
|
||||
# probably meed to be more sane about this
|
||||
if r.status_code != 200 or len(resp_xml.findall("{*}Error")) > 0:
|
||||
resp_xml = etree.XML(r.content)
|
||||
if len(resp_xml.findall("{*}Error")) > 0:
|
||||
raise RemoteError(r)
|
||||
return resp_xml
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user