worker-automate-hub 0.5.37__py3-none-any.whl → 0.5.38__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- worker_automate_hub/api/ahead_service.py +30 -21
- {worker_automate_hub-0.5.37.dist-info → worker_automate_hub-0.5.38.dist-info}/METADATA +1 -1
- {worker_automate_hub-0.5.37.dist-info → worker_automate_hub-0.5.38.dist-info}/RECORD +5 -5
- {worker_automate_hub-0.5.37.dist-info → worker_automate_hub-0.5.38.dist-info}/WHEEL +0 -0
- {worker_automate_hub-0.5.37.dist-info → worker_automate_hub-0.5.38.dist-info}/entry_points.txt +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
import asyncio
|
1
2
|
import os
|
2
3
|
from pathlib import Path
|
3
4
|
import getpass
|
@@ -5,6 +6,7 @@ import aiohttp
|
|
5
6
|
from worker_automate_hub.config.settings import load_env_config
|
6
7
|
from worker_automate_hub.utils.logger import logger
|
7
8
|
|
9
|
+
|
8
10
|
async def get_xml(chave_acesso: str):
|
9
11
|
env_config, _ = load_env_config()
|
10
12
|
try:
|
@@ -31,26 +33,33 @@ async def get_xml(chave_acesso: str):
|
|
31
33
|
logger.error(err_msg)
|
32
34
|
return None
|
33
35
|
|
36
|
+
|
34
37
|
async def save_xml_to_downloads(chave_acesso: str):
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
38
|
+
MAX_RETRIES = 3
|
39
|
+
|
40
|
+
for attempt in range(1, MAX_RETRIES + 1):
|
41
|
+
xml_content = await get_xml(chave_acesso)
|
42
|
+
if xml_content:
|
43
|
+
try:
|
44
|
+
downloads_path = Path.home() / "Downloads"
|
45
|
+
downloads_path.mkdir(parents=True, exist_ok=True)
|
46
|
+
|
47
|
+
file_name = f"{chave_acesso}.xml"
|
48
|
+
file_path = downloads_path / file_name
|
49
|
+
|
50
|
+
with open(file_path, "w", encoding="utf-8") as f:
|
51
|
+
f.write(xml_content)
|
52
|
+
|
53
|
+
logger.info(f"XML salvo em {file_path}")
|
54
|
+
return True
|
55
|
+
except Exception as e:
|
56
|
+
err_msg = f"Erro ao salvar o XML: {e}"
|
57
|
+
logger.error(err_msg)
|
58
|
+
else:
|
59
|
+
err_msg = "Não foi possível obter o XML."
|
51
60
|
logger.error(err_msg)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
61
|
+
|
62
|
+
if attempt < MAX_RETRIES:
|
63
|
+
await asyncio.sleep(2)
|
64
|
+
|
65
|
+
return False
|
@@ -1,6 +1,6 @@
|
|
1
1
|
worker_automate_hub/__init__.py,sha256=LV28uQvBfpPIqudGIMJmVB8E941MjXHcu8DMoX5n8AM,25
|
2
2
|
worker_automate_hub/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
worker_automate_hub/api/ahead_service.py,sha256=
|
3
|
+
worker_automate_hub/api/ahead_service.py,sha256=_zqvVOEYZm0khuzlUGipUpAW_is9nSC_H7gJ9WOoaP0,2230
|
4
4
|
worker_automate_hub/api/client.py,sha256=tFrIr4mpjvUJ1uU--BCiWa3NT2Ru_yliBsWmfiGt1LA,19720
|
5
5
|
worker_automate_hub/api/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
worker_automate_hub/api/helpers/api_helpers.py,sha256=SkheO2fXexeh-a4shr8Qzsz_kZhuSG0DJ7kbODctRbM,3696
|
@@ -75,7 +75,7 @@ worker_automate_hub/utils/updater.py,sha256=en2FCGhI8aZ-JNP3LQm64NJDc4awCNW7UhbV
|
|
75
75
|
worker_automate_hub/utils/util.py,sha256=famjVaoCDHLUoULQIGvqpVDu9gQihOLH2Nv1kCTsSqc,130967
|
76
76
|
worker_automate_hub/utils/utils_nfe_entrada.py,sha256=ZTb1XoKWZY7coXt06iIE8KI56N6AguhZv5DEPX2qUu8,31862
|
77
77
|
worker_automate_hub/worker.py,sha256=CT-poyP1ZYvubArYsnnNd9oJ53SPaDwgr6p6keS3nI4,6248
|
78
|
-
worker_automate_hub-0.5.
|
79
|
-
worker_automate_hub-0.5.
|
80
|
-
worker_automate_hub-0.5.
|
81
|
-
worker_automate_hub-0.5.
|
78
|
+
worker_automate_hub-0.5.38.dist-info/entry_points.txt,sha256=sddyhjx57I08RY8X7UxcTpdoOsWULAWNKN9Xr6pp_Kw,54
|
79
|
+
worker_automate_hub-0.5.38.dist-info/METADATA,sha256=dyoCaTkXEmC5wHgl-NZ20vFy2b88rZfya_Hq_XOn4gw,2894
|
80
|
+
worker_automate_hub-0.5.38.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
81
|
+
worker_automate_hub-0.5.38.dist-info/RECORD,,
|
File without changes
|
{worker_automate_hub-0.5.37.dist-info → worker_automate_hub-0.5.38.dist-info}/entry_points.txt
RENAMED
File without changes
|