I'm downloading some data from a wsdl api using zeep. When testing the code some errors occured so I'm trying to handle them with try except structures, but when the RemoteDisconnected error raises, I don't know exactly how to deal with it. My best attempt as far is the following:
def datos_factura(clave_acceso, wsdl_client):
try:
with wsdl_client.settings(raw_response=True):
response = wsdl_client.service.autorizacionComprobante(clave_acceso)
print(f'Comprobante no {clave_acceso}')
print('Status: {}'.format(response.status_code))
except ConnectionError as connerror:
print(connerror)
check_later.append(clave_acceso)
pass
except ConnectionAbortedError as connab:
print(connab)
check_later.append(clave_acceso)
pass
except ConnectionRefusedError as connref:
print(conneref)
check_later.append(clave_acceso)
pass
except ConnectionResetError as connreset:
print(connereset)
check_later.append(clave_acceso)
pass
except http.client.RemoteDisconnected as rem:
print(rem)
check_later.append(clave_acceso)
finally:
tree = et.fromstring(response.content.decode('utf-8'))
Please explain me the right way to catch that error
question from:
https://stackoverflow.com/questions/65921205/how-to-handle-remotedisconnected-when-downloading-data-with-zeep 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…