scorb-api 0.2.0__tar.gz → 0.2.2__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.
- {scorb_api-0.2.0 → scorb_api-0.2.2}/PKG-INFO +1 -1
- {scorb_api-0.2.0 → scorb_api-0.2.2}/pyproject.toml +1 -1
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/helpers/http.py +8 -1
- scorb_api-0.2.2/scorb_api/models/endpoints/reports/__init__.py +62 -0
- scorb_api-0.2.0/scorb_api/models/endpoints/reports/__init__.py +0 -34
- {scorb_api-0.2.0 → scorb_api-0.2.2}/LICENSE +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/README.md +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/authorization.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoint.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/endpoint_customizado.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_customizadas/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/alert_definition.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/cenario_visao.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/centro_custo.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/centro_custo_verba_valor_real.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/check_caderias_total.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/check_caderias_total_por_verba.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/consulta_cadeira_fixo.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/consulta_centro_de_custo_fixo_new.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/consulta_centro_de_custo_fixo_old.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/conta_contabil.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/cotacao.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/expressao_customizada.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/faixa_salarial_esquema.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/funcao_customizada.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/funcionario.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/funcionario_alocacao.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/funcionario_salario_previsto.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/grupo_centro_custo.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/moeda.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/plano_contas.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/posicao.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/reajuste_alcance_motivo.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/report_calculated_field.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/verba.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/verba_centro_custo_depara.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/verba_reajuste_conta_contabil.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/alcance_tipo.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/atributo_customizado.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/cenario.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/cenario_campo.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/cenario_categoria.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/inventario_template.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/projector_template.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/resumo_hc_e_salario_cc_e_empresa.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/tabela_customizada.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/validation_configuration.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/inventarios/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/tabelas_customizadas/__init__.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/task_request.py +0 -0
- {scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/utils/filter_clean_utils.py +0 -0
|
@@ -14,8 +14,10 @@ class HTTPRequest:
|
|
|
14
14
|
parameters: dict = None,
|
|
15
15
|
data: Any = None,
|
|
16
16
|
json: Any = None,
|
|
17
|
+
timeout: int = 500,
|
|
17
18
|
) -> dict:
|
|
18
|
-
|
|
19
|
+
base_url = config("SCORB_BASE_URL")
|
|
20
|
+
request_url = urljoin(base=base_url, url=endpoint)
|
|
19
21
|
headers = {**headers} if headers else {}
|
|
20
22
|
response = None
|
|
21
23
|
|
|
@@ -25,6 +27,7 @@ class HTTPRequest:
|
|
|
25
27
|
url=request_url,
|
|
26
28
|
headers=headers,
|
|
27
29
|
params=parameters,
|
|
30
|
+
timeout=timeout
|
|
28
31
|
)
|
|
29
32
|
|
|
30
33
|
elif method == "post":
|
|
@@ -34,6 +37,7 @@ class HTTPRequest:
|
|
|
34
37
|
params=parameters,
|
|
35
38
|
data=data,
|
|
36
39
|
json=json,
|
|
40
|
+
timeout=timeout
|
|
37
41
|
)
|
|
38
42
|
|
|
39
43
|
elif method == "put":
|
|
@@ -43,6 +47,7 @@ class HTTPRequest:
|
|
|
43
47
|
params=parameters,
|
|
44
48
|
data=data,
|
|
45
49
|
json=json,
|
|
50
|
+
timeout=timeout
|
|
46
51
|
)
|
|
47
52
|
|
|
48
53
|
elif method == "patch":
|
|
@@ -52,6 +57,7 @@ class HTTPRequest:
|
|
|
52
57
|
params=parameters,
|
|
53
58
|
data=data,
|
|
54
59
|
json=json,
|
|
60
|
+
timeout=timeout
|
|
55
61
|
)
|
|
56
62
|
|
|
57
63
|
elif method == "delete":
|
|
@@ -61,6 +67,7 @@ class HTTPRequest:
|
|
|
61
67
|
params=parameters,
|
|
62
68
|
data=data,
|
|
63
69
|
json=json,
|
|
70
|
+
timeout=timeout
|
|
64
71
|
)
|
|
65
72
|
else:
|
|
66
73
|
raise ValueError("Invalid HTTP method")
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from scorb_api.models.endpoint import Endpoint
|
|
2
|
+
import asyncio
|
|
3
|
+
from time import sleep
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Report(Endpoint):
|
|
7
|
+
def __init__(self, header_auth, report_name) -> None:
|
|
8
|
+
super().__init__(header_auth=header_auth)
|
|
9
|
+
self.base_url = f"/api/SCORC/crud/{report_name}"
|
|
10
|
+
|
|
11
|
+
def read(
|
|
12
|
+
self,
|
|
13
|
+
cenario: str,
|
|
14
|
+
from_date: str,
|
|
15
|
+
to_date: str,
|
|
16
|
+
output_format: str = "2",
|
|
17
|
+
timeout: int = 600,
|
|
18
|
+
) -> list:
|
|
19
|
+
response = self.__request_report_generation(
|
|
20
|
+
output_format=output_format,
|
|
21
|
+
cenario=cenario,
|
|
22
|
+
from_date=from_date,
|
|
23
|
+
to_date=to_date,
|
|
24
|
+
timeout=timeout,
|
|
25
|
+
)
|
|
26
|
+
report_status_url = response["jobStatusUrl"]
|
|
27
|
+
report_result_url = response["jobResultUrl"]
|
|
28
|
+
is_report_completed = False
|
|
29
|
+
while not is_report_completed:
|
|
30
|
+
report_status = asyncio.run(
|
|
31
|
+
self.http_request.request(
|
|
32
|
+
report_status_url,
|
|
33
|
+
"get",
|
|
34
|
+
headers=self.header_auth,
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
sleep(20)
|
|
38
|
+
is_report_completed = report_status["Completed"]
|
|
39
|
+
report_data = asyncio.run(
|
|
40
|
+
self.http_request.request(
|
|
41
|
+
report_result_url, "get", headers=self.header_auth
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
return report_data["Items"]
|
|
45
|
+
|
|
46
|
+
def __request_report_generation(
|
|
47
|
+
self, output_format="2", cenario=None, from_date=None, to_date=None, timeout=600
|
|
48
|
+
):
|
|
49
|
+
return asyncio.run(
|
|
50
|
+
self.http_request.request(
|
|
51
|
+
f"{self.base_url}/read-async",
|
|
52
|
+
"post",
|
|
53
|
+
headers=self.header_auth,
|
|
54
|
+
json={
|
|
55
|
+
"outputFormat": output_format,
|
|
56
|
+
"cenario": cenario,
|
|
57
|
+
"from": from_date,
|
|
58
|
+
"to": to_date,
|
|
59
|
+
},
|
|
60
|
+
timeout=timeout,
|
|
61
|
+
)
|
|
62
|
+
)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from scorb_api.models.endpoint import Endpoint
|
|
2
|
-
import asyncio
|
|
3
|
-
from time import sleep
|
|
4
|
-
|
|
5
|
-
class Report(Endpoint):
|
|
6
|
-
def __init__(self, header_auth, report_name) -> None:
|
|
7
|
-
super().__init__(header_auth=header_auth)
|
|
8
|
-
self.base_url = f"/api/SCORC/crud/{report_name}"
|
|
9
|
-
|
|
10
|
-
def read(self, output_format="2"):
|
|
11
|
-
response = self.__request_report_generation(output_format=output_format)
|
|
12
|
-
report_status_url = response["jobStatusUrl"]
|
|
13
|
-
report_result_url = response["jobResultUrl"]
|
|
14
|
-
is_report_completed = False
|
|
15
|
-
while not is_report_completed:
|
|
16
|
-
report_status = asyncio.run(self.http_request.request(
|
|
17
|
-
report_status_url, "get", headers=self.header_auth,
|
|
18
|
-
))
|
|
19
|
-
sleep(10)
|
|
20
|
-
is_report_completed = report_status["Completed"]
|
|
21
|
-
report_data = asyncio.run(self.http_request.request(
|
|
22
|
-
report_result_url, "get", headers=self.header_auth,
|
|
23
|
-
))
|
|
24
|
-
return report_data["Items"]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def __request_report_generation(self, output_format="2"):
|
|
28
|
-
return asyncio.run(
|
|
29
|
-
self.http_request.request(
|
|
30
|
-
f"{self.base_url}/read-async", "post", headers=self.header_auth,
|
|
31
|
-
json={"outputFormat": output_format}
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_customizadas/__init__.py
RENAMED
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/cenario_visao.py
RENAMED
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/centro_custo.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/conta_contabil.py
RENAMED
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/cotacao.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/funcionario.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/plano_contas.py
RENAMED
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/entidade_de_cenario/posicao.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
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/atributo_customizado.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/inventario_template.py
RENAMED
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/projector_template.py
RENAMED
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/tabela_customizada.py
RENAMED
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/globais/validation_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
{scorb_api-0.2.0 → scorb_api-0.2.2}/scorb_api/models/endpoints/tabelas_customizadas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|