bcpkgfox 0.17.3__tar.gz → 0.17.5__tar.gz
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.
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/PKG-INFO +2 -11
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/invoke_api.py +117 -104
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox.egg-info/PKG-INFO +2 -11
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/setup.py +1 -1
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/README.md +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/__init__.py +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/clean.py +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/cli.py +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/find_elements.py +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/get_driver.py +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox/system.py +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox.egg-info/SOURCES.txt +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox.egg-info/dependency_links.txt +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox.egg-info/entry_points.txt +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox.egg-info/requires.txt +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/bcpkgfox.egg-info/top_level.txt +0 -0
- {bcpkgfox-0.17.3 → bcpkgfox-0.17.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: bcpkgfox
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.5
|
|
4
4
|
Summary: Biblioteca BCFOX
|
|
5
5
|
Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
|
|
6
6
|
Author: Guilherme Neri
|
|
@@ -42,12 +42,3 @@ Requires-Dist: pymupdf; extra == "full"
|
|
|
42
42
|
Requires-Dist: Pillow; extra == "full"
|
|
43
43
|
Requires-Dist: psutil; extra == "full"
|
|
44
44
|
Requires-Dist: pynput; extra == "full"
|
|
45
|
-
Dynamic: author
|
|
46
|
-
Dynamic: author-email
|
|
47
|
-
Dynamic: classifier
|
|
48
|
-
Dynamic: description-content-type
|
|
49
|
-
Dynamic: home-page
|
|
50
|
-
Dynamic: provides-extra
|
|
51
|
-
Dynamic: requires-dist
|
|
52
|
-
Dynamic: requires-python
|
|
53
|
-
Dynamic: summary
|
|
@@ -167,7 +167,7 @@ def invoke_api_proc_log(link, id_robo, token):
|
|
|
167
167
|
"POST", link, json=payload, headers=headers)
|
|
168
168
|
print(f"\n{responseinsert.json()}")
|
|
169
169
|
|
|
170
|
-
def login_2fac(driver, certificate, system, token, code_timeout=
|
|
170
|
+
def login_2fac(driver, certificate, system, token, code_timeout=10):
|
|
171
171
|
import requests
|
|
172
172
|
import pyautogui
|
|
173
173
|
from . import mostrar_mensagem
|
|
@@ -332,9 +332,13 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
332
332
|
self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
|
|
333
333
|
|
|
334
334
|
def codes_2_fac(self):
|
|
335
|
-
|
|
335
|
+
element_sistema = '//input[(contains(@placeholder,"selecione um sistema pra acessar") or contains(@name, "system")) and contains(@role, "combobox")]'
|
|
336
|
+
element_email = '//input[contains(@placeholder,"Insira aqui o seu email") or contains(@placeholder,"e-mail")]'
|
|
337
|
+
email = 'eliezer@bcfox.com.br'
|
|
338
|
+
element_code = '//input[contains(@placeholder,"Digite aqui o código que enviamos para o seu e-mail") or contains(@placeholder,"código") or contains(@type,"password")]'
|
|
339
|
+
element_submit ='//button[contains(@type, "submit")]'
|
|
336
340
|
try:
|
|
337
|
-
tools.find_element_with_wait(By.XPATH, '
|
|
341
|
+
tools.find_element_with_wait(By.XPATH, f'{element_sistema}', timeout=2).send_keys(self.system)
|
|
338
342
|
code_insertion = True
|
|
339
343
|
|
|
340
344
|
except:
|
|
@@ -342,9 +346,9 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
342
346
|
|
|
343
347
|
# Request the code
|
|
344
348
|
for _ in range(50): # Wait the extension to load
|
|
345
|
-
|
|
349
|
+
time.sleep(1)
|
|
346
350
|
try:
|
|
347
|
-
tools.find_element_with_wait(By.XPATH, '
|
|
351
|
+
tools.find_element_with_wait(By.XPATH, f'{element_email}', timeout=1).send_keys(f'{email}')
|
|
348
352
|
time.sleep(1)
|
|
349
353
|
break
|
|
350
354
|
except:
|
|
@@ -353,136 +357,145 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
|
|
|
353
357
|
# Envia o código pro email, o for é só para tratativa de bugs
|
|
354
358
|
for _ in range(10):
|
|
355
359
|
try:
|
|
356
|
-
tools.find_element_with_wait(By.XPATH, '
|
|
360
|
+
tools.find_element_with_wait(By.XPATH, f'{element_code}', timeout=1)
|
|
357
361
|
break
|
|
358
362
|
|
|
359
363
|
except:
|
|
360
364
|
try:
|
|
361
|
-
element = tools.find_element_with_wait(By.XPATH, '
|
|
365
|
+
element = tools.find_element_with_wait(By.XPATH, f'{element_email}', timeout=1)
|
|
362
366
|
element.clear()
|
|
363
|
-
element.send_keys('
|
|
364
|
-
tools.find_element_with_wait(By.XPATH, '
|
|
367
|
+
element.send_keys(f'{email}')
|
|
368
|
+
tools.find_element_with_wait(By.XPATH, f'{element_submit}').click()
|
|
365
369
|
time.sleep(1)
|
|
366
370
|
except:
|
|
367
371
|
break
|
|
368
372
|
|
|
369
373
|
# Attempts the new codes until success or requests limit
|
|
370
374
|
for _ in range(code_timeout):
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
element = tools.find_element_with_wait(By.XPATH, '//input[@type="password"]')
|
|
381
|
-
element.clear()
|
|
382
|
-
element.send_keys(CODE)
|
|
383
|
-
|
|
384
|
-
for _ in range(10):
|
|
385
|
-
try:
|
|
386
|
-
tools.find_element_with_wait(By.XPATH, '//div/div[2]/button', timeout=2).click()
|
|
387
|
-
time.sleep(1)
|
|
388
|
-
except:
|
|
389
|
-
break
|
|
390
|
-
|
|
391
|
-
# Check the code result
|
|
392
|
-
for _ in range(30):
|
|
393
|
-
|
|
394
|
-
# Correct
|
|
395
|
-
try:
|
|
396
|
-
# input('\n\n > Selecione o sistema e aperte alguma tecla.')
|
|
397
|
-
tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1).send_keys(self.system)
|
|
398
|
-
api.invoke_update_status(ID) #FIX: Update
|
|
399
|
-
code_insertion = True
|
|
400
|
-
break
|
|
401
|
-
|
|
402
|
-
except:
|
|
403
|
-
pass
|
|
375
|
+
def adicionar_code():
|
|
376
|
+
responses = api.invoke_get_codes()
|
|
377
|
+
if not responses:
|
|
378
|
+
time.sleep(2)
|
|
379
|
+
return [], None
|
|
380
|
+
# Try new codes
|
|
381
|
+
code_insertion = False
|
|
382
|
+
for response in responses:
|
|
383
|
+
time.sleep(1)
|
|
404
384
|
|
|
405
|
-
|
|
406
|
-
try:
|
|
407
|
-
tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'Senha inválida')]", timeout=1)
|
|
408
|
-
tools.find_element_with_wait(By.XPATH, "//button[text()='Voltar']", timeout=1).click()
|
|
409
|
-
code_insertion = False
|
|
385
|
+
if 'Escolha um certificado' in self.driver.page_source:
|
|
410
386
|
break
|
|
411
387
|
|
|
412
|
-
|
|
413
|
-
|
|
388
|
+
CODE = response['CODIGO']
|
|
389
|
+
ID = response['ID']
|
|
414
390
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
391
|
+
element = tools.find_element_with_wait(By.XPATH, '//input[@type="password"]')
|
|
392
|
+
element.clear()
|
|
393
|
+
element.send_keys(CODE)
|
|
394
|
+
button_entrar_click = False
|
|
395
|
+
for _ in range(20):
|
|
396
|
+
try:
|
|
397
|
+
button = tools.find_element_with_wait(By.XPATH, f'{element_submit}', timeout=2)
|
|
398
|
+
if button.get_attribute('disabled'):
|
|
399
|
+
time.sleep(1.5)
|
|
400
|
+
continue
|
|
401
|
+
button.click()
|
|
402
|
+
button_entrar_click = True
|
|
403
|
+
if 'Escolha um certificado' in self.driver.page_source:
|
|
404
|
+
break
|
|
405
|
+
|
|
406
|
+
time.sleep(1)
|
|
407
|
+
except:
|
|
408
|
+
break
|
|
409
|
+
|
|
410
|
+
if int(_) == 20 and button_entrar_click == False:
|
|
411
|
+
raise TimeoutError('Código Whom falhou ao entrar')
|
|
412
|
+
|
|
413
|
+
return responses, ID
|
|
414
|
+
|
|
415
|
+
responses, ID = adicionar_code()
|
|
416
|
+
|
|
417
|
+
if 'Sair' in self.driver.page_source and not 'Verifique seu e-mail' in self.driver.page_source:
|
|
418
|
+
api.invoke_update_status(ID) # FIX: Update
|
|
420
419
|
break
|
|
421
420
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
# Selects the system to access
|
|
426
|
-
lines = tools.find_elements_with_wait(By.XPATH, '//div[@role="menu"]//div[@role="menuitem"]')
|
|
421
|
+
if 'Verifique seu e-mail':
|
|
422
|
+
responses,ID = adicionar_code()
|
|
427
423
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
424
|
+
for _ in range(60):
|
|
425
|
+
if not(responses):
|
|
426
|
+
responses,ID = adicionar_code()
|
|
427
|
+
time.sleep(1)
|
|
428
|
+
else:
|
|
429
|
+
break
|
|
433
430
|
|
|
434
|
-
|
|
431
|
+
if not (responses):
|
|
432
|
+
raise TimeoutError('Código WHOOM não chegou dentro do timeout estabelecido')
|
|
433
|
+
# Wrong
|
|
435
434
|
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
try:
|
|
436
|
+
tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'Senha inválida')]",
|
|
437
|
+
timeout=1)
|
|
438
|
+
tools.find_element_with_wait(By.XPATH, "//button[text()='Voltar']", timeout=1).click()
|
|
439
|
+
code_insertion = False
|
|
440
|
+
break
|
|
438
441
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if self.certificate.lower().strip() in titulo_text.lower().strip():
|
|
442
|
-
finded = True
|
|
443
|
-
continue
|
|
442
|
+
except:
|
|
443
|
+
pass
|
|
444
444
|
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
if 'Sair' in self.driver.page_source and not 'Verifique seu e-mail' in self.driver.page_source:
|
|
446
|
+
api.invoke_update_status(ID) # FIX: Update
|
|
447
|
+
break
|
|
447
448
|
|
|
448
|
-
|
|
449
|
-
|
|
449
|
+
code_insertion = False
|
|
450
|
+
# Check the code result
|
|
451
|
+
for _ in range(30):
|
|
452
|
+
if code_insertion:
|
|
453
|
+
break
|
|
454
|
+
# Correct
|
|
455
|
+
try:
|
|
456
|
+
tools.find_element_with_wait(By.XPATH,"//input[(contains(@name,'certificate') or contains(@placeholder,'certificado')) and not(contains(@type, 'hidden'))]", timeout=1).send_keys(self.certificate)
|
|
457
|
+
list_certific = tools.find_elements_with_wait(By.XPATH,'//div[contains(@role,"option")]')
|
|
458
|
+
list_certific[0].click()
|
|
459
|
+
time.sleep(1)
|
|
460
|
+
code_insertion = True
|
|
461
|
+
break
|
|
462
|
+
except:
|
|
463
|
+
pass
|
|
450
464
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
465
|
+
time.sleep(4)
|
|
466
|
+
code_insertion = False
|
|
467
|
+
for _ in range(30):
|
|
468
|
+
try:
|
|
469
|
+
# input('\n\n > Selecione o sistema e aperte alguma tecla.')
|
|
470
|
+
tools.find_element_with_wait(By.XPATH, f'{element_sistema}', timeout=1).send_keys(self.system)
|
|
471
|
+
time.sleep(1)
|
|
472
|
+
list_sistemas = tools.find_elements_with_wait(By.XPATH, '//div[contains(@role,"option")]')
|
|
473
|
+
if len(list_sistemas) == 1:
|
|
474
|
+
list_sistemas[0].click()
|
|
475
|
+
code_insertion = True
|
|
476
|
+
break
|
|
477
|
+
else:
|
|
478
|
+
mostrar_mensagem(
|
|
479
|
+
'Mais de um sistema encontrado, verifique o nome do sistema no WHOOM e coloque um nome único na função')
|
|
480
|
+
raise ValueError('Mais de um sistema encontrado, verifique o nome')
|
|
481
|
+
except:
|
|
482
|
+
pass
|
|
454
483
|
|
|
455
|
-
|
|
456
|
-
|
|
484
|
+
if code_insertion:
|
|
485
|
+
break
|
|
457
486
|
|
|
458
|
-
|
|
487
|
+
if code_insertion:
|
|
488
|
+
tools.find_element_with_wait(By.XPATH, f"//button[contains(@data-testid,'submit') or contains(text(), 'Acessar')]").click()
|
|
489
|
+
print('Logado')
|
|
459
490
|
else:
|
|
460
|
-
|
|
461
|
-
div_text = div.find_element(By.XPATH, './span').text
|
|
462
|
-
if self.system.lower().strip() not in div_text.lower().strip():
|
|
463
|
-
div_list.remove(div)
|
|
464
|
-
|
|
465
|
-
if len(div_list) == 1:
|
|
466
|
-
div_list[0].click()
|
|
467
|
-
else:
|
|
468
|
-
mostrar_mensagem('Mais de um sistema encontrado, verifique o nome do sistema no WHOOM e coloque um nome único na função')
|
|
469
|
-
raise ValueError('Mais de um sistema encontrado, verifique o nome')
|
|
470
|
-
|
|
471
|
-
# Verifies if the system was opened
|
|
472
|
-
for _ in range(30):
|
|
473
|
-
time.sleep(1)
|
|
474
|
-
if len(self.driver.window_handles) == 1:
|
|
475
|
-
try:
|
|
476
|
-
tools.find_element_with_wait(By.XPATH, "//button[text()='Acessar']", timeout=1).click()
|
|
477
|
-
except:
|
|
478
|
-
time.sleep(1)
|
|
479
|
-
else:
|
|
480
|
-
time.sleep(3)
|
|
481
|
-
break
|
|
491
|
+
raise TimeoutError('Código WHOOM não chegou dentro do timeout estabelecido')
|
|
482
492
|
|
|
493
|
+
time.sleep(2)
|
|
483
494
|
self.driver.switch_to.window(self.driver.window_handles[-1])
|
|
484
495
|
attempt = 0
|
|
485
496
|
while 'whoom' in self.driver.title.strip().lower() and attempt <= 180:
|
|
497
|
+
if 'Sistema temporariamente indisponível. Tente novamente mais tarde.' in self.driver.page_source:
|
|
498
|
+
raise SystemError('Sistema indisponivel no momento.')
|
|
486
499
|
time.sleep(1)
|
|
487
500
|
attempt += 1
|
|
488
501
|
time.sleep(5)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: bcpkgfox
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.5
|
|
4
4
|
Summary: Biblioteca BCFOX
|
|
5
5
|
Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
|
|
6
6
|
Author: Guilherme Neri
|
|
@@ -42,12 +42,3 @@ Requires-Dist: pymupdf; extra == "full"
|
|
|
42
42
|
Requires-Dist: Pillow; extra == "full"
|
|
43
43
|
Requires-Dist: psutil; extra == "full"
|
|
44
44
|
Requires-Dist: pynput; extra == "full"
|
|
45
|
-
Dynamic: author
|
|
46
|
-
Dynamic: author-email
|
|
47
|
-
Dynamic: classifier
|
|
48
|
-
Dynamic: description-content-type
|
|
49
|
-
Dynamic: home-page
|
|
50
|
-
Dynamic: provides-extra
|
|
51
|
-
Dynamic: requires-dist
|
|
52
|
-
Dynamic: requires-python
|
|
53
|
-
Dynamic: summary
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|