worker-automate-hub 0.4.427__tar.gz → 0.4.429__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/PKG-INFO +1 -1
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/pyproject.toml +1 -1
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/conexao_rdp.py +33 -32
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/README.md +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/ahead_service.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/client.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/helpers/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/helpers/api_helpers.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/rpa_historico_service.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/cli.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/config/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/config/settings.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/config.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/core/so_manipulation.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/deprecation.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/rate_limit.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/repeat.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/retry.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/singleton.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/timeit.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dao/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dao/rpa_configuracao.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dao/rpa_historico.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dao/rpa_processo.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dto/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dto/rpa_historico_request_dto.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dto/rpa_processo_entrada_dto.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dto/rpa_processo_rdp_dto.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/dto/rpa_sistema_dto.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/coleta_dje_process.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/descartes.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/ecac_estadual_go.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/ecac_estadual_main.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/ecac_estadual_mt.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/ecac_estadual_sc.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/ecac_estadual_sp.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/ecac_federal.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_15.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_16.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_207.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_32.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_33.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_34.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_36.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_39.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_500.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_505.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_7139.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/entrada_de_notas_9.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/exemplo_processo.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/fidc_gerar_nosso_numero.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/fidc_remessa_cobranca_cnab240.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/login_emsys.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/playground.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/sped_fiscal.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/jobs/transferencias.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/task_definitions.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/task_executor.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/__init__.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/env.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/get_creds_gworkspace.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/logger.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/toast.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/updater.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/util.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/utils_nfe_entrada.py +0 -0
- {worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/worker.py +0 -0
@@ -10,6 +10,7 @@ from pywinauto import Application
|
|
10
10
|
from worker_automate_hub.models.dto.rpa_historico_request_dto import RpaHistoricoStatusEnum, RpaRetornoProcessoDTO
|
11
11
|
from worker_automate_hub.models.dto.rpa_processo_rdp_dto import RpaProcessoRdpDTO
|
12
12
|
from worker_automate_hub.utils.logger import logger
|
13
|
+
from worker_automate_hub.utils.util import worker_sleep
|
13
14
|
|
14
15
|
console = Console()
|
15
16
|
|
@@ -25,16 +26,16 @@ class RDPConnection:
|
|
25
26
|
|
26
27
|
async def verificar_conexao(self) -> bool:
|
27
28
|
sistema_operacional = platform.system().lower()
|
28
|
-
|
29
|
+
console.print(f"Sistema operacional detectado: {sistema_operacional}")
|
29
30
|
if sistema_operacional == "windows":
|
30
31
|
comando_ping = ["ping", "-n", "1", "-w", "1000", self.ip]
|
31
32
|
else:
|
32
33
|
comando_ping = ["ping", "-c", "1", "-W", "1", self.ip]
|
33
|
-
|
34
|
+
console.print(f"Executando comando de ping: {' '.join(comando_ping)}")
|
34
35
|
try:
|
35
36
|
resposta_ping = subprocess.run(comando_ping, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
36
37
|
ping_alcancado = resposta_ping.returncode == 0
|
37
|
-
|
38
|
+
console.print(f"Ping {'sucesso' if ping_alcancado else 'falhou'}")
|
38
39
|
except Exception as e:
|
39
40
|
logger.error(f"Erro ao executar ping: {e}")
|
40
41
|
ping_alcancado = False
|
@@ -42,11 +43,11 @@ class RDPConnection:
|
|
42
43
|
porta_aberta = False
|
43
44
|
try:
|
44
45
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
45
|
-
sock.settimeout(
|
46
|
-
|
46
|
+
sock.settimeout(10)
|
47
|
+
console.print(f"Verificando porta 3389 em {self.ip}")
|
47
48
|
resposta_porta = sock.connect_ex((self.ip, 3389))
|
48
49
|
porta_aberta = resposta_porta == 0
|
49
|
-
|
50
|
+
console.print(f"Porta 3389 {'aberta' if porta_aberta else 'fechada'}")
|
50
51
|
except Exception as e:
|
51
52
|
logger.error(f"Erro ao verificar a porta RDP: {e}")
|
52
53
|
porta_aberta = False
|
@@ -68,10 +69,10 @@ class RDPConnection:
|
|
68
69
|
for titulo in janelas_rdp:
|
69
70
|
janela = gw.getWindowsWithTitle(titulo)[0]
|
70
71
|
if not janela:
|
71
|
-
print(f"Erro ao localizar a janela: {titulo}")
|
72
|
+
console.print(f"Erro ao localizar a janela: {titulo}")
|
72
73
|
continue
|
73
74
|
|
74
|
-
print(f"Processando janela: {titulo}")
|
75
|
+
console.print(f"Processando janela: {titulo}")
|
75
76
|
|
76
77
|
# Obtém as coordenadas da janela
|
77
78
|
x, y = janela.left, janela.top
|
@@ -81,27 +82,27 @@ class RDPConnection:
|
|
81
82
|
pyautogui.moveTo(x + 10, y + 10) # Ajuste para alinhar ao título da janela
|
82
83
|
pyautogui.click(button="right")
|
83
84
|
|
84
|
-
await
|
85
|
+
await worker_sleep(5)
|
85
86
|
pyautogui.press("down", presses=7, interval=0.1)
|
86
|
-
await
|
87
|
+
await worker_sleep(5)
|
87
88
|
pyautogui.hotkey("enter")
|
88
|
-
await
|
89
|
+
await worker_sleep(5)
|
89
90
|
pyautogui.hotkey("enter")
|
90
91
|
|
91
92
|
except Exception as e:
|
92
|
-
print(f"Erro ao interagir com a janela {titulo}: {e}")
|
93
|
+
console.print(f"Erro ao interagir com a janela {titulo}: {e}")
|
93
94
|
|
94
95
|
async def conectar(self):
|
95
|
-
|
96
|
+
console.print(f"Iniciando cliente RDP para {self.ip}")
|
96
97
|
try:
|
97
98
|
pyautogui.hotkey("win", "d")
|
98
|
-
await
|
99
|
-
|
99
|
+
await worker_sleep(5) # Tempo para garantir que todas as janelas sejam minimizadas
|
100
|
+
console.print("Todas as janelas minimizadas com sucesso.")
|
100
101
|
|
101
102
|
subprocess.Popen(["mstsc", f"/v:{self.ip}"], close_fds=True, start_new_session=True)
|
102
|
-
await
|
103
|
+
await worker_sleep(10) # Tempo aumentado para garantir abertura
|
103
104
|
|
104
|
-
|
105
|
+
console.print("Procurando janela 'Conexão de Área de Trabalho Remota'")
|
105
106
|
windows = gw.getWindowsWithTitle("Conexão de Área de Trabalho Remota")
|
106
107
|
if not windows:
|
107
108
|
logger.warning("Tentando encontrar janela com título em inglês 'Remote Desktop Connection'")
|
@@ -112,12 +113,12 @@ class RDPConnection:
|
|
112
113
|
return False
|
113
114
|
|
114
115
|
rdp_window = windows[0]
|
115
|
-
|
116
|
+
console.print(f"Janela '{rdp_window.title}' encontrada. Focando na janela.")
|
116
117
|
|
117
118
|
# Restaurar janela se estiver minimizada
|
118
119
|
if rdp_window.isMinimized:
|
119
120
|
rdp_window.restore()
|
120
|
-
await
|
121
|
+
await worker_sleep(5)
|
121
122
|
|
122
123
|
# Redimensionar para 50% da tela
|
123
124
|
screen_width, screen_height = pyautogui.size()
|
@@ -125,14 +126,14 @@ class RDPConnection:
|
|
125
126
|
new_height = screen_height // 2
|
126
127
|
rdp_window.resizeTo(new_width, new_height)
|
127
128
|
rdp_window.moveTo(screen_width // 4, screen_height // 4)
|
128
|
-
|
129
|
+
console.print(f"Janela redimensionada para {new_width}x{new_height}.")
|
129
130
|
|
130
131
|
rdp_window.activate()
|
131
|
-
await
|
132
|
+
await worker_sleep(5) # Tempo extra para garantir que a janela está ativa
|
132
133
|
|
133
134
|
# Clique para garantir o foco
|
134
135
|
pyautogui.click(rdp_window.left + 50, rdp_window.top + 50)
|
135
|
-
await
|
136
|
+
await worker_sleep(3)
|
136
137
|
|
137
138
|
# Inserir credenciais
|
138
139
|
|
@@ -143,24 +144,24 @@ class RDPConnection:
|
|
143
144
|
edit_field = dialog.child_window(auto_id="EditField_1", control_type="Edit")
|
144
145
|
|
145
146
|
if edit_field.exists():
|
146
|
-
|
147
|
+
console.print("Inserindo usuário.")
|
147
148
|
pyautogui.write(self.user, interval=0.1)
|
148
149
|
pyautogui.press("tab")
|
149
|
-
await
|
150
|
+
await worker_sleep(5)
|
150
151
|
except:
|
151
152
|
pass
|
152
153
|
|
153
|
-
|
154
|
+
console.print("Inserindo senha.")
|
154
155
|
pyautogui.write(self.password, interval=0.1)
|
155
156
|
pyautogui.press("enter")
|
156
|
-
await
|
157
|
+
await worker_sleep(5)
|
157
158
|
pyautogui.press("left")
|
158
|
-
await
|
159
|
+
await worker_sleep(5)
|
159
160
|
pyautogui.press("enter")
|
160
|
-
|
161
|
-
await
|
161
|
+
console.print("Credenciais inseridas.")
|
162
|
+
await worker_sleep(5) # Tempo para conexão ser concluída
|
162
163
|
|
163
|
-
|
164
|
+
console.print("Conexão RDP ativa. Mantendo o script em execução.")
|
164
165
|
return True
|
165
166
|
except Exception as e:
|
166
167
|
logger.error(f"Erro ao tentar conectar via RDP: {e}")
|
@@ -168,7 +169,7 @@ class RDPConnection:
|
|
168
169
|
|
169
170
|
async def conexao_rdp(task: RpaProcessoRdpDTO) -> RpaRetornoProcessoDTO:
|
170
171
|
try:
|
171
|
-
|
172
|
+
console.print("Iniciando processo de conexão RDP.")
|
172
173
|
rdp = RDPConnection(task)
|
173
174
|
conectado = await rdp.verificar_conexao()
|
174
175
|
if not conectado:
|
@@ -180,7 +181,7 @@ async def conexao_rdp(task: RpaProcessoRdpDTO) -> RpaRetornoProcessoDTO:
|
|
180
181
|
)
|
181
182
|
sucesso_conexao = await rdp.conectar()
|
182
183
|
if sucesso_conexao:
|
183
|
-
|
184
|
+
console.print("Processo de conexão RDP executado com sucesso.")
|
184
185
|
|
185
186
|
await rdp.clicar_no_titulo()
|
186
187
|
|
File without changes
|
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/ahead_service.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/api/client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/config/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/config/settings.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/repeat.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/retry.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/decorators/timeit.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/models/__init__.py
RENAMED
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
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/tasks/__init__.py
RENAMED
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/__init__.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/env.py
RENAMED
File without changes
|
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/logger.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/toast.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/updater.py
RENAMED
File without changes
|
{worker_automate_hub-0.4.427 → worker_automate_hub-0.4.429}/worker_automate_hub/utils/util.py
RENAMED
File without changes
|
File without changes
|
File without changes
|