bcpkgfox 0.18.1__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 +16 -0
- {bcpkgfox-0.18.1.dist-info → bcpkgfox-0.18.2.dist-info}/METADATA +1 -1
- {bcpkgfox-0.18.1.dist-info → bcpkgfox-0.18.2.dist-info}/RECORD +7 -7
- {bcpkgfox-0.18.1.dist-info → bcpkgfox-0.18.2.dist-info}/WHEEL +0 -0
- {bcpkgfox-0.18.1.dist-info → bcpkgfox-0.18.2.dist-info}/entry_points.txt +0 -0
- {bcpkgfox-0.18.1.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
|
@@ -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
|
# ══════════════════════════════════════════════════════════════
|
|
@@ -828,6 +839,11 @@ class _LoginPje:
|
|
|
828
839
|
return True
|
|
829
840
|
else:
|
|
830
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
|
|
831
847
|
|
|
832
848
|
def _fechar_popup_certificado(self):
|
|
833
849
|
if "Certificado próximo de expirar" in self.driver.page_source:
|
|
@@ -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
|