diff --git a/cep/exc.py b/cep/exc.py new file mode 100644 index 0000000..5e0ec9c --- /dev/null +++ b/cep/exc.py @@ -0,0 +1,12 @@ +class CepError(Exception): + """ + Error interno del sitio web + https://www.banxico.org.mx/cep/ + """ + + +class MaxRequestError(CepError): + """ + Máximo número de peticiones alcanzadas para + obtener el CEP de una transferencia + """ diff --git a/tests/cassettes/test_lanza_cep_error_para_errores_500.yaml b/tests/cassettes/test_lanza_cep_error_para_errores_500.yaml new file mode 100644 index 0000000..1bdb0fd --- /dev/null +++ b/tests/cassettes/test_lanza_cep_error_para_errores_500.yaml @@ -0,0 +1,957 @@ +interactions: +- request: + body: tipoCriterio=T&receptorParticipante=0&captcha=c&tipoConsulta=1&fecha=19-04-2022&criterio=CUENCA927820173168&emisor=90646&receptor=40012&cuenta=012180000&monto=0.01 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '172' + Content-Type: + - application/x-www-form-urlencoded + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: http://www.banxico.org.mx/cep/valida.do + response: + body: + string: '' + headers: + Connection: + - Keep-Alive + Content-Length: + - '0' + Date: + - Tue, 19 Apr 2022 21:17:33 GMT + Location: + - https://www.banxico.org.mx/cep/valida.do + Server: + - mxbanxico + status: + code: 307 + message: Temporary Redirect +- request: + body: tipoCriterio=T&receptorParticipante=0&captcha=c&tipoConsulta=1&fecha=19-04-2022&criterio=CUENCA927820173168&emisor=90646&receptor=40012&cuenta=012180000&monto=0.01 + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '172' + Content-Type: + - application/x-www-form-urlencoded + User-Agent: + - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, + like Gecko) Chrome/75.0.3770.142 Safari/537.36 + method: POST + uri: https://www.banxico.org.mx/cep/valida.do + response: + body: + string: "\n
\r\n La imagen de seguridad no fue\ + \ ingresada correctamente. Favor de validar.\r\n
\r\n+ + Error 500--Internal Server + Error+ + |
From RFC 2068 Hypertext + Transfer Protocol -- HTTP/1.1:+ +10.5.1 500 Internal Server Error+ +The server encountered an unexpected condition + which prevented it from fulfilling the request. + + |