bcpkgfox 0.18.0__py3-none-any.whl → 0.18.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bcpkgfox might be problematic. Click here for more details.
- bcpkgfox/__init__.py +31 -14
- bcpkgfox/login_2factor.py +18 -2
- {bcpkgfox-0.18.0.dist-info → bcpkgfox-0.18.2.dist-info}/METADATA +1 -1
- {bcpkgfox-0.18.0.dist-info → bcpkgfox-0.18.2.dist-info}/RECORD +7 -7
- {bcpkgfox-0.18.0.dist-info → bcpkgfox-0.18.2.dist-info}/WHEEL +0 -0
- {bcpkgfox-0.18.0.dist-info → bcpkgfox-0.18.2.dist-info}/entry_points.txt +0 -0
- {bcpkgfox-0.18.0.dist-info → bcpkgfox-0.18.2.dist-info}/top_level.txt +0 -0
bcpkgfox/__init__.py
CHANGED
|
@@ -225,7 +225,7 @@ def wait_for_element_disappear(object, type, timeout=10):
|
|
|
225
225
|
|
|
226
226
|
return find_elements.backcode__dont_use__wait_for_d(driver, object, type, timeout=tempo)
|
|
227
227
|
|
|
228
|
-
def selectfox(elemento, method, key, relative = None):
|
|
228
|
+
def selectfox(elemento, method, key, relative = None, unicode=False):
|
|
229
229
|
"""
|
|
230
230
|
Seleciona uma opção em um elemento <select>.
|
|
231
231
|
|
|
@@ -262,22 +262,39 @@ def selectfox(elemento, method, key, relative = None):
|
|
|
262
262
|
if method == "value":
|
|
263
263
|
select.select_by_value(key)
|
|
264
264
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
265
|
+
elements = select.options
|
|
266
|
+
if method == "text" and not unicode:
|
|
267
|
+
for elm in elements:
|
|
268
|
+
if relative:
|
|
269
|
+
if key.lower().strip() in elm.text.lower().strip():
|
|
270
|
+
select.select_by_visible_text(elm.text)
|
|
271
|
+
return
|
|
272
|
+
else:
|
|
273
|
+
if key == elm.text:
|
|
274
|
+
select.select_by_visible_text(elm.text)
|
|
275
|
+
return
|
|
276
|
+
|
|
277
|
+
if method == "text" and unicode:
|
|
278
|
+
key_normalize = normalize(key.lower().strip())
|
|
279
|
+
for elm in elements:
|
|
280
|
+
text_normalize = normalize(elm.text.lower().strip())
|
|
281
|
+
if relative:
|
|
282
|
+
if key_normalize in text_normalize:
|
|
283
|
+
select.select_by_visible_text(elm.text)
|
|
284
|
+
return
|
|
285
|
+
else:
|
|
286
|
+
if key_normalize == text_normalize:
|
|
287
|
+
select.select_by_visible_text(elm.text)
|
|
288
|
+
return
|
|
289
|
+
|
|
290
|
+
raise ModuleNotFoundError(f"Option {key} não encontrada")
|
|
278
291
|
|
|
279
292
|
if method == "index":
|
|
280
293
|
select.select_by_index(key)
|
|
294
|
+
def normalize(text):
|
|
295
|
+
import unicodedata
|
|
296
|
+
return unicodedata.normalize("NFKD", text).encode("ASCII", "ignore").decode("ASCII").lower()
|
|
297
|
+
|
|
281
298
|
|
|
282
299
|
def pop_up_extract(text: bool = False, accept: bool = False, timeout: int = 10, driver_instance: Optional[WebElement] = None):
|
|
283
300
|
""" Identifica um pop-up simples extraindo o texto e aceitando ele também. \n
|
bcpkgfox/login_2factor.py
CHANGED
|
@@ -477,7 +477,7 @@ class _LoginEproc:
|
|
|
477
477
|
Verifica se o login foi feito diretamente (sem necessidade de 2FA).
|
|
478
478
|
"""
|
|
479
479
|
page_source = self.driver.page_source
|
|
480
|
-
indicadores_sucesso = ["Painel do Advogado", "Citações/Intimações", "Painel do usuário", "selInfraUnidades"]
|
|
480
|
+
indicadores_sucesso = ["Painel do Advogado", "Citações/Intimações", "Painel do usuário", "selInfraUnidades", "Seleção de perfil"]
|
|
481
481
|
return any(indicador in page_source for indicador in indicadores_sucesso)
|
|
482
482
|
|
|
483
483
|
def _finalizar_login(self):
|
|
@@ -571,6 +571,17 @@ class _LoginPje:
|
|
|
571
571
|
self.driver.get(f"{self.url_procurada}")
|
|
572
572
|
time.sleep(2)
|
|
573
573
|
|
|
574
|
+
|
|
575
|
+
if self._verica_captcha():
|
|
576
|
+
if self._util.deve_usar_whom():
|
|
577
|
+
self._util.login_via_whom()
|
|
578
|
+
if self._verificar_ja_logado():
|
|
579
|
+
print(" ✓ Login via WHOM realizado com sucesso!")
|
|
580
|
+
return True
|
|
581
|
+
else:
|
|
582
|
+
print("⚠ Login via WHOM falhou. Não há fallback disponível para este estado.")
|
|
583
|
+
raise Exception("Falha no login via WHOM")
|
|
584
|
+
|
|
574
585
|
# ══════════════════════════════════════════════════════════════
|
|
575
586
|
# PRIORIDADE 1: Verifica se já está logado
|
|
576
587
|
# ══════════════════════════════════════════════════════════════
|
|
@@ -671,7 +682,6 @@ class _LoginPje:
|
|
|
671
682
|
if self._verificar_ja_logado():
|
|
672
683
|
return True
|
|
673
684
|
|
|
674
|
-
#TODO ADICIONAR AREA DO OTP
|
|
675
685
|
code = self._obter_codigo_2fa()
|
|
676
686
|
if code:
|
|
677
687
|
self._insert_codigo_2fa(code)
|
|
@@ -829,6 +839,11 @@ class _LoginPje:
|
|
|
829
839
|
return True
|
|
830
840
|
else:
|
|
831
841
|
return False
|
|
842
|
+
def _verica_captcha(self):
|
|
843
|
+
if 'Vamos confirmar que você é humano' in self.driver.page_source:
|
|
844
|
+
return True
|
|
845
|
+
else:
|
|
846
|
+
return False
|
|
832
847
|
|
|
833
848
|
def _fechar_popup_certificado(self):
|
|
834
849
|
if "Certificado próximo de expirar" in self.driver.page_source:
|
|
@@ -898,6 +913,7 @@ class _LoginPje:
|
|
|
898
913
|
except (TimeoutException, NoSuchElementException):
|
|
899
914
|
# Formulário OTP não apareceu, continua normalmente
|
|
900
915
|
pass
|
|
916
|
+
|
|
901
917
|
class _Utils:
|
|
902
918
|
def __init__(self, driver, api, url_procurada, uf, sistema, advogado, token, tipo='mysena'):
|
|
903
919
|
self.driver = driver
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
bcpkgfox/__init__.py,sha256
|
|
1
|
+
bcpkgfox/__init__.py,sha256=-bmfKCkIei1XQs5Fu4_cpRBLPPuRYW0kE73lTkATs38,17310
|
|
2
2
|
bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
|
|
3
3
|
bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
|
|
4
4
|
bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
|
|
5
5
|
bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
|
|
6
6
|
bcpkgfox/invoke_api.py,sha256=MEwbdBW6PtnKRGTv6Mezw3Fx7NsHdDHsnKT-1CZIOQA,21832
|
|
7
|
-
bcpkgfox/login_2factor.py,sha256=
|
|
7
|
+
bcpkgfox/login_2factor.py,sha256=iC79wj0qZFz5RjuAYvkmon1CI95WPNsk6TZ9wOQYX-k,46248
|
|
8
8
|
bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
|
|
9
|
-
bcpkgfox-0.18.
|
|
10
|
-
bcpkgfox-0.18.
|
|
11
|
-
bcpkgfox-0.18.
|
|
12
|
-
bcpkgfox-0.18.
|
|
13
|
-
bcpkgfox-0.18.
|
|
9
|
+
bcpkgfox-0.18.2.dist-info/METADATA,sha256=grb7X9URO7HrT7IpycuGbnUfJTgNpSJJcvRhM3Plxvk,1893
|
|
10
|
+
bcpkgfox-0.18.2.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
11
|
+
bcpkgfox-0.18.2.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
|
|
12
|
+
bcpkgfox-0.18.2.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
|
|
13
|
+
bcpkgfox-0.18.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|