diff --git a/pyitau/pages.py b/pyitau/pages.py index 08d0ca9..ed6a8b4 100644 --- a/pyitau/pages.py +++ b/pyitau/pages.py @@ -237,23 +237,15 @@ def first_card_id(self): class CheckingAccountFullStatement(TextPage): + _url_pattern = 'url\s*=\s*"([^"]*)";' + @property def filter_statements_by_period_op(self): - pattern = ( - r"function consultarLancamentosPorPeriodo.*" - r'"periodoConsulta" : parametrosPeriodo.*?' - r'url = "(.*?)";' - ) - return re.search(pattern, self._text, flags=re.DOTALL).group(1) + return re.findall(self._url_pattern, self._text, flags=re.DOTALL)[2] @property def filter_statements_by_month_op(self): - pattern = ( - r"function consultarLancamentosPorPeriodo.*" - r'"mesCompleto" : parametrosPeriodo.*?' - r'url = "(.*?)";' - ) - return re.search(pattern, self._text, flags=re.DOTALL).group(1) + return re.findall(self._url_pattern, self._text, flags=re.DOTALL)[1] class CardDetails(TextPage): diff --git a/tests/responses/checking_account_full_statement.html b/tests/responses/checking_account_full_statement.html index e905bd0..ccd0932 100644 --- a/tests/responses/checking_account_full_statement.html +++ b/tests/responses/checking_account_full_statement.html @@ -1,42 +1,161 @@