bcpkgfox 0.17.9__py3-none-any.whl → 0.17.11__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
@@ -201,7 +201,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
201
201
  except:
202
202
  pass
203
203
 
204
- time.sleep(0.1)
204
+ time.sleep(1)
205
205
 
206
206
  def start(self):
207
207
  self.status = True
@@ -523,7 +523,7 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
523
523
  pass
524
524
 
525
525
  # Verifies if the system was opened
526
- for _ in range(30):
526
+ for _ in range(40):
527
527
  time.sleep(1)
528
528
  if len(self.driver.window_handles) == 1:
529
529
  try:
@@ -561,4 +561,4 @@ def login_2fac(driver, certificate, system, token, code_timeout=60):
561
561
  bot.extension_check()
562
562
  protection.start()
563
563
  bot.codes_2_fac()
564
- bot.select_system()
564
+ bot.select_system()
@@ -0,0 +1,99 @@
1
+ import requests, time
2
+
3
+ class Login2facmycena:
4
+ def __init__(self, uf, sistema, advogado, token, maximo = 5):
5
+ self.codes = None
6
+ self.api = ApiControll(uf, sistema, advogado, token)
7
+ self.code_timeout = maximo
8
+
9
+ def processar_codes(self):
10
+ max_attempts = self.code_timeout
11
+ five_attempts = 0
12
+ ten_attempts = 0
13
+
14
+ while five_attempts <= max_attempts:
15
+ five_attempts += 1
16
+ self.codes = self.api.listar_codigos_otp()
17
+ if self.codes:
18
+ print("Códigos obtidos com sucesso:")
19
+ return self.codes
20
+ else:
21
+ print("Solicitando novo codigo.")
22
+ self.api.solicitar_codigos_otp()
23
+ time.sleep(10)
24
+ while ten_attempts <=10:
25
+ ten_attempts += 1
26
+ self.codes = self.api.listar_codigos_otp()
27
+ if self.codes:
28
+ return self.codes
29
+ time.sleep(10)
30
+ return None
31
+ return None
32
+
33
+
34
+ class ApiControll:
35
+ def __init__(self, uf, sistema, advogado, tk):
36
+ super().__init__()
37
+ self.uf = uf
38
+ self.sistema = sistema
39
+ self.advogado = advogado
40
+ self.token = tk
41
+
42
+
43
+ def solicitar_codigos_otp(self):
44
+ url = "https://api-4.bcfox.com.br/bcjur/views/codigos-otp"
45
+ headers = {
46
+ "x-access-token": self.token,
47
+ "Content-Type": "application/json"
48
+ }
49
+
50
+ payload = {
51
+ "uf": self.uf,
52
+ "advogado": self.advogado,
53
+ "sistema": self.sistema
54
+ }
55
+
56
+ for tentativa in range(1, 6):
57
+ try:
58
+ response = requests.post(url, headers=headers, json=payload, timeout=30)
59
+
60
+ if response.status_code == 200:
61
+ print(
62
+ f"Tentativa {tentativa}: Requisição bem-sucedida. Código de status: {response.status_code}")
63
+ response_data = response.json()
64
+ print(response_data)
65
+ return response_data
66
+ else:
67
+ print(f"Tentativa {tentativa}: Erro na requisição. Código de status: {response.status_code}")
68
+
69
+ except requests.RequestException as e:
70
+ print(f"Tentativa {tentativa}: Ocorreu um erro na requisição: {e}")
71
+
72
+ time.sleep(1)
73
+
74
+ return None
75
+
76
+ def listar_codigos_otp(self):
77
+ url = f"https://api-4.bcfox.com.br/bcjur/views/codigos-otp/robo/{self.uf}/{self.sistema}/{self.advogado}"
78
+ headers = {"x-access-token": self.token}
79
+
80
+ # Retries authenticated OTP code listing on failure
81
+ for tentativa in range(1, 6):
82
+ try:
83
+ response = requests.get(url, headers=headers, timeout=30)
84
+
85
+ if response.status_code == 200:
86
+ response_data = response.json()
87
+ if response_data:
88
+ return response_data[0].get("CODIGO_OTP")
89
+
90
+ else:
91
+ print(f"Tentativa {tentativa}: Status {response.status_code}")
92
+
93
+ except requests.RequestException as e:
94
+ print(f"Tentativa {tentativa}: Erro na requisição: {e}")
95
+
96
+ time.sleep(1)
97
+ return None
98
+
99
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.17.9
3
+ Version: 0.17.11
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: BCFOX
@@ -0,0 +1,13 @@
1
+ bcpkgfox/__init__.py,sha256=49TPbTUNI6xKcYk4blwseUZQTgHtRcNI1AFEqxSQ3wY,16540
2
+ bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
3
+ bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
4
+ bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
5
+ bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
6
+ bcpkgfox/invoke_api.py,sha256=DSaeHRGAvi0BV05anvZknzuiSBUvv1lmQ35xX_JFyC4,21296
7
+ bcpkgfox/login_2factor.py,sha256=FWC7-KP8IeGbyiwgDr9ZhPTlf26iq7Nzl5nhgIjjrdE,3592
8
+ bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
9
+ bcpkgfox-0.17.11.dist-info/METADATA,sha256=SqllVVHVNnDKpMkYY9M93OPAQy2tPDox2kKcUkGrhWc,1894
10
+ bcpkgfox-0.17.11.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
11
+ bcpkgfox-0.17.11.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
12
+ bcpkgfox-0.17.11.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
13
+ bcpkgfox-0.17.11.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- bcpkgfox/__init__.py,sha256=49TPbTUNI6xKcYk4blwseUZQTgHtRcNI1AFEqxSQ3wY,16540
2
- bcpkgfox/clean.py,sha256=80pJDTGmKmPiq73uL1IWopuxqVJF_bj_RVv-njkpl-A,8946
3
- bcpkgfox/cli.py,sha256=E1Yahd8jIjUwxM6EMHveDDne5-fh8QeAvAhyATNatEo,33541
4
- bcpkgfox/find_elements.py,sha256=oeB-73LqMLoKchozPXuxRkThBju9IgUKqbgU-2AAq0s,23027
5
- bcpkgfox/get_driver.py,sha256=ohimk9E2hL6T35IXv0XX0uvWDGCUZvZDlPMnuRjV1R0,30490
6
- bcpkgfox/invoke_api.py,sha256=2lUVCqPWGAufO5m3HS7_LPvyq7AbmNyaanABxM0licA,21296
7
- bcpkgfox/system.py,sha256=3lyOWx893T6KiAI-jDv7zAo3oKPf0Q5CLgZ8TeFd0Do,7901
8
- bcpkgfox-0.17.9.dist-info/METADATA,sha256=5w-k7X8TKIBRZh_9c6bvcaiAqC2HTG6iFeu8krAkFhw,1893
9
- bcpkgfox-0.17.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- bcpkgfox-0.17.9.dist-info/entry_points.txt,sha256=qmaEg6K7Y0HOeaFo-G6lf44InGkeVI4I6hqobcY_nns,653
11
- bcpkgfox-0.17.9.dist-info/top_level.txt,sha256=h01SqyYBEfS72vkRFOlEDZBUSu9pzU0bdX4m9hWNNmw,9
12
- bcpkgfox-0.17.9.dist-info/RECORD,,