From eeff87ba2ea016d748a1040e15a35f676422e867 Mon Sep 17 00:00:00 2001 From: Magno Costa Date: Wed, 14 Aug 2024 15:59:15 -0300 Subject: [PATCH] [REF] l10n_br_account_payment_brcobranca: Solve 'E8106(external-request-timeout) Use of external request method without timeout. It could wait for a long time.' --- l10n_br_account_payment_brcobranca/models/account_move.py | 7 ++++++- .../models/account_payment_order.py | 1 + .../parser/cnab_file_parser.py | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/l10n_br_account_payment_brcobranca/models/account_move.py b/l10n_br_account_payment_brcobranca/models/account_move.py index c9c6e8ef8f4a..7d1624e7be52 100644 --- a/l10n_br_account_payment_brcobranca/models/account_move.py +++ b/l10n_br_account_payment_brcobranca/models/account_move.py @@ -71,7 +71,12 @@ def _get_brcobranca_boleto(self, boletos): brcobranca_service_url, self.name, ) - res = requests.post(brcobranca_service_url, data={"type": "pdf"}, files=files) + res = requests.post( + brcobranca_service_url, + data={"type": "pdf"}, + files=files, + timeout=5, + ) if str(res.status_code)[0] == "2": pdf_string = res.content diff --git a/l10n_br_account_payment_brcobranca/models/account_payment_order.py b/l10n_br_account_payment_brcobranca/models/account_payment_order.py index 33c3c322e376..5c2d3b2b13b3 100644 --- a/l10n_br_account_payment_brcobranca/models/account_payment_order.py +++ b/l10n_br_account_payment_brcobranca/models/account_payment_order.py @@ -190,6 +190,7 @@ def _get_brcobranca_remessa(self, bank_brcobranca, remessa_values, cnab_type): "bank": bank_brcobranca.name, }, files=files, + timeout=5, ) if cnab_type == "240" and "R01" in res.text[242:254]: diff --git a/l10n_br_account_payment_brcobranca/parser/cnab_file_parser.py b/l10n_br_account_payment_brcobranca/parser/cnab_file_parser.py index 955a0896810b..719909112cf8 100644 --- a/l10n_br_account_payment_brcobranca/parser/cnab_file_parser.py +++ b/l10n_br_account_payment_brcobranca/parser/cnab_file_parser.py @@ -91,6 +91,7 @@ def _get_brcobranca_retorno(self, files): "bank": bank_name_brcobranca, }, files=files, + timeout=5, ) if res.status_code != 201: