bcpkgfox 0.16.66__py3-none-any.whl → 0.16.68__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/invoke_api.py CHANGED
@@ -262,17 +262,32 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
262
262
 
263
263
  except:
264
264
  self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
265
+
265
266
  # Request the code
266
267
  for _ in range(50): # Wait the extension to load
267
268
 
268
269
  try:
269
- tools.find_element_with_wait(By.XPATH, '//*[@id="root"]/div/div[1]/div//div//input', timeout=1).send_keys('eliezer@bcfox.com.br')
270
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1).send_keys('eliezer@bcfox.com.br')
270
271
  time.sleep(1)
271
272
  break
272
273
  except:
273
274
  self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
274
275
 
275
- tools.find_element_with_wait(By.XPATH, '//button').click()
276
+ # Envia o código pro email, o for é só para tratativa de bugs
277
+ for _ in range(10):
278
+ try:
279
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite aqui o código que enviamos para o seu e-mail"]', timeout=1)
280
+ break
281
+
282
+ except:
283
+ try:
284
+ element = tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
285
+ element.clear()
286
+ element.send_keys('eliezer@bcfox.com.br')
287
+ tools.find_element_with_wait(By.XPATH, '//button').click()
288
+ time.sleep(1)
289
+ except:
290
+ break
276
291
 
277
292
  # Attempts the new codes until success or requests limit
278
293
  for _ in range(code_timeout):
@@ -285,7 +300,10 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
285
300
  CODE = response['CODIGO']
286
301
  ID = response['ID']
287
302
 
288
- tools.find_element_with_wait(By.XPATH, '//input[@type="password"]').send_keys(CODE)
303
+ element = tools.find_element_with_wait(By.XPATH, '//input[@type="password"]')
304
+ element.clear()
305
+ element.send_keys(CODE)
306
+
289
307
  for _ in range(10):
290
308
  try:
291
309
  tools.find_element_with_wait(By.XPATH, '//div/div[2]/button', timeout=2).click()
@@ -294,7 +312,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
294
312
  break
295
313
 
296
314
  # Check the code result
297
- for _ in range(7):
315
+ for _ in range(30):
298
316
 
299
317
  # Correct
300
318
  try:
@@ -310,7 +328,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
310
328
  # Wrong
311
329
  try:
312
330
  tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'Senha inválida')]", timeout=1)
313
- tools.find_element_with_wait(By.XPATH, "//button[text()='Voltar']", timeout=1)
331
+ tools.find_element_with_wait(By.XPATH, "//button[text()='Voltar']", timeout=1).click()
314
332
  code_insertion = False
315
333
  break
316
334
 
@@ -329,15 +347,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
329
347
  raise TimeoutError('Código WHOOM não chegou dentro do timeout estabelecido')
330
348
 
331
349
  # Selects the system to access
332
- try:
333
- lines = tools.find_elements_with_wait(By.XPATH, '//*[@id="root"]/div[2]/div/div[1]/div/div[2]/div/div/div', timeout=5)
334
- except:
335
- try:
336
- lines = tools.find_elements_with_wait(By.XPATH, '//*[@id="root"]/div[2]/div/div[2]/div/div[2]/div/div/div', timeout=5)
337
- except Exception as e:
338
- mostrar_mensagem('Não conseguiu achar o sistema no certificado')
339
- print(f'{e}\n\n\n\n\n\n')
340
- raise ValueError('Não conseguiu achar o sistema no certificado') from e
350
+ lines = tools.find_elements_with_wait(By.XPATH, '//div[@role="menu"]//div[@role="menuitem"]')
341
351
 
342
352
  finded = False
343
353
  div_list = []
@@ -401,43 +411,52 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
401
411
  def extension_check(self):
402
412
 
403
413
  self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
414
+ time.sleep(3)
404
415
 
405
- try:
406
- tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=10).send_keys(self.system)
407
- return
416
+ for _ in range(10):
417
+
418
+ # Caso a extensão já esteja instalada
419
+ try:
420
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Digite ou selecione um sistema pra acessar"]', timeout=1)
421
+ return
422
+ except: pass
408
423
 
409
- except Exception as e:
424
+ try:
425
+ tools.find_element_with_wait(By.XPATH, '//input[@placeholder="Insira aqui o seu email"]', timeout=1)
426
+ return
427
+ except: pass
428
+
429
+ # Caso a extensão não esteja instala
430
+ if 'This page has been blocked by Chrome' in driver.page_source:
431
+ break
410
432
 
411
433
  if 'eliezer@bcfox.com.br' in self.driver.page_source:
412
434
  tools.find_element_with_wait(By.XPATH, "//span[text()='alterar']").click()
413
435
  return
414
436
 
415
- # Abrir uma nova aba
416
- self.driver.execute_script("window.open('');")
437
+ # Abrir uma nova aba
438
+ self.driver.execute_script("window.open('');")
417
439
 
418
- # Fechar a aba original
419
- self.driver.close()
440
+ # Fechar a aba original
441
+ self.driver.close()
420
442
 
421
- # Mudar para a nova aba
422
- self.driver.switch_to.window(self.driver.window_handles[-1])
443
+ # Mudar para a nova aba
444
+ self.driver.switch_to.window(self.driver.window_handles[-1])
423
445
 
424
- time.sleep(1)
446
+ time.sleep(1)
425
447
 
426
- self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
448
+ self.driver.get("https://chromewebstore.google.com/detail/whom-gerenciador-de-certi/lnidijeaekolpfeckelhkomndglcglhh")
427
449
 
428
- try:
429
- tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
430
- except Exception as e:
431
- return
432
- time.sleep(5)
450
+ tools.find_element_with_wait(By.XPATH, "//span[contains(text(), 'no Chrome') or contains(text(), 'Usar') or contains(text(), 'Add to Chrome')]").click()
451
+ time.sleep(5)
433
452
 
434
- # Envia TAB e ENTER do teclado físico
435
- pyautogui.press('tab')
436
- time.sleep(0.5)
437
- pyautogui.press('enter')
438
- time.sleep(5)
453
+ # Envia TAB e ENTER do teclado físico
454
+ pyautogui.press('tab')
455
+ time.sleep(0.5)
456
+ pyautogui.press('enter')
457
+ time.sleep(5)
439
458
 
440
- self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
459
+ self.driver.get('chrome-extension://lnidijeaekolpfeckelhkomndglcglhh/index.html')
441
460
 
442
461
  tools = tool()
443
462
  api = invokes_whoom()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.66
3
+ Version: 0.16.68
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -4,10 +4,10 @@ bcpkgfox/cli.py,sha256=6k4GNZimGKKkntuzy54EDKuvc_N0XKWr2N_Ho7nINxw,33497
4
4
  bcpkgfox/exec_file.py,sha256=fl_Do2SlF7JuXazpNTod-e_0WZUk355fbd7ustQvi40,3728
5
5
  bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
6
6
  bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
7
- bcpkgfox/invoke_api.py,sha256=94BAkIPdcX5EF2xem1s3cUBsMLVdM-pSYksVr0onCMg,16904
7
+ bcpkgfox/invoke_api.py,sha256=vZGXq4xNbROqtFJQ0PMivFCRypkIv6pX0bTLF8SWDIc,17591
8
8
  bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
9
- bcpkgfox-0.16.66.dist-info/METADATA,sha256=H2LthzRuLogLcUC8an6LtVnOMC3g60W3oBA9PalUyKc,1912
10
- bcpkgfox-0.16.66.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
- bcpkgfox-0.16.66.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
- bcpkgfox-0.16.66.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
- bcpkgfox-0.16.66.dist-info/RECORD,,
9
+ bcpkgfox-0.16.68.dist-info/METADATA,sha256=U8nXOkn9gxI0JcXEB1eTP6stUZw9rguihlNYH0Xc1Bc,1912
10
+ bcpkgfox-0.16.68.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
+ bcpkgfox-0.16.68.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
+ bcpkgfox-0.16.68.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
+ bcpkgfox-0.16.68.dist-info/RECORD,,