From 751106792b513b4b7833f05e9f4c9b9812e33c36 Mon Sep 17 00:00:00 2001 From: Felipe Ferreira Date: Fri, 5 Jul 2019 12:11:02 -0300 Subject: [PATCH 1/3] Retorno do parse por itens de movimento do processo --- processostjrj/download_processo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processostjrj/download_processo.py b/processostjrj/download_processo.py index 92e3b5d..84fffa3 100644 --- a/processostjrj/download_processo.py +++ b/processostjrj/download_processo.py @@ -47,7 +47,7 @@ def processo(processo, headers=None, timeout=10): fim)) dados_processo['hash'] = cria_hash_do_processo( json.dumps(dados_processo)) - # dados_processo.update(parse_itens(soup, processo, inicio + 1)) + dados_processo.update(parse_itens(soup, processo, inicio + 1)) except Exception as erro: _LOGGER.error( "Erro de parsing do processo - {0}, com mensagem: {1}".format( From ff05e7b1eb9a343ff08b0221fb7afce874b2eed4 Mon Sep 17 00:00:00 2001 From: Felipe Ferreira Date: Fri, 5 Jul 2019 12:28:38 -0300 Subject: [PATCH 2/3] =?UTF-8?q?Corre=C3=A7=C3=A3o=20de=20erros=20de=20test?= =?UTF-8?q?es=20e=20flake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- processostjrj/download_processo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/processostjrj/download_processo.py b/processostjrj/download_processo.py index 84fffa3..6eeb09e 100644 --- a/processostjrj/download_processo.py +++ b/processostjrj/download_processo.py @@ -15,7 +15,8 @@ "consultaMov.do?v=2&numProcesso={doc_number}&" "acessoIP=internet&tipoUsuario" ) -URL_PROCESSO_2 = 'http://www4.tjrj.jus.br/numeracaoUnica/faces/index.jsp?numProcesso={doc_number}' +URL_PROCESSO_2 = ('http://www4.tjrj.jus.br/numeracaoUnica/' + 'faces/index.jsp?numProcesso={doc_number}') _LOGGER = Logger('processostjrj.processo') @@ -32,7 +33,7 @@ def processo(processo, headers=None, timeout=10): headers=headers, timeout=10 ) - if b'e outro(s)...' in resp.content: + if 'e outro(s)...' in resp.content: resp = requests.post(URL_PROCESSO_2.format( doc_number=numero_processo) ) From dd6439d6262553e3f6039b2911284d86fc939c3c Mon Sep 17 00:00:00 2001 From: Felipe Ferreira Date: Fri, 5 Jul 2019 12:37:35 -0300 Subject: [PATCH 3/3] =?UTF-8?q?Corre=C3=A7=C3=A3o=20nos=20testes=20de=20do?= =?UTF-8?q?wnload=20do=20processo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- processostjrj/download_processo.py | 2 +- tests/test_pipeline.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/processostjrj/download_processo.py b/processostjrj/download_processo.py index 6eeb09e..20c99e4 100644 --- a/processostjrj/download_processo.py +++ b/processostjrj/download_processo.py @@ -33,7 +33,7 @@ def processo(processo, headers=None, timeout=10): headers=headers, timeout=10 ) - if 'e outro(s)...' in resp.content: + if b'e outro(s)...' in resp.content: resp = requests.post(URL_PROCESSO_2.format( doc_number=numero_processo) ) diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 4088dd8..6306695 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -18,7 +18,7 @@ def test_pipeline_do_parsing_dos_processos(self, _fnp, _req, _chdp, _bs, _am, _pm, _pi): nprocesso = '1234' numero_formatado = '1.2.3.4' - html = '{"a": 1}' + html = b'{"a": 1}' _resp_mock = MagicMock() _resp_mock.content = html @@ -38,7 +38,7 @@ def test_pipeline_do_parsing_dos_processos(self, _fnp, _req, _chdp, _bs, doc_number=numero_formatado), headers={'X-Forwarded-For': '10.0.250.15'}, timeout=10) - _chdp.assert_called_once_with(html) + _chdp.assert_called_once_with('{"a": 1}') _bs.assert_called_once_with(html, 'lxml') _soup_mock.find_all.assert_called_once_with('tr') _am.assert_called_once_with('rows_mock')