scorb-api 0.1.8__tar.gz → 0.2.0__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.1.8 → scorb_api-0.2.0}/PKG-INFO +1 -1
- {scorb_api-0.1.8 → scorb_api-0.2.0}/pyproject.toml +1 -1
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/__init__.py +19 -14
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/authorization.py +11 -6
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/reports/__init__.py +8 -6
- {scorb_api-0.1.8 → scorb_api-0.2.0}/LICENSE +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/README.md +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/helpers/http.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoint.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/__init__.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/endpoint_customizado.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_customizadas/__init__.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/__init__.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/alert_definition.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/cenario_visao.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/centro_custo.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/centro_custo_verba_valor_real.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/check_caderias_total.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/check_caderias_total_por_verba.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/consulta_cadeira_fixo.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/consulta_centro_de_custo_fixo_new.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/consulta_centro_de_custo_fixo_old.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/conta_contabil.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/cotacao.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/expressao_customizada.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/faixa_salarial_esquema.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/funcao_customizada.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/funcionario.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/funcionario_alocacao.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/funcionario_salario_previsto.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/grupo_centro_custo.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/moeda.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/plano_contas.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/posicao.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/reajuste_alcance_motivo.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/report_calculated_field.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/verba.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/verba_centro_custo_depara.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/verba_reajuste_conta_contabil.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/__init__.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/alcance_tipo.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/atributo_customizado.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/cenario.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/cenario_campo.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/cenario_categoria.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/inventario_template.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/projector_template.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/resumo_hc_e_salario_cc_e_empresa.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/tabela_customizada.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/validation_configuration.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/inventarios/__init__.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/tabelas_customizadas/__init__.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/task_request.py +0 -0
- {scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/utils/filter_clean_utils.py +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
from scorb_api.models.endpoints import Globais
|
|
3
2
|
from scorb_api.models.endpoints import EntidadesDeCenario
|
|
4
3
|
from scorb_api.models.endpoints import TabelasCustomizadas
|
|
@@ -11,6 +10,7 @@ from scorb_api.models.endpoints import Inventario
|
|
|
11
10
|
|
|
12
11
|
from scorb_api.models.authorization import Authorization
|
|
13
12
|
|
|
13
|
+
|
|
14
14
|
class ScorbApiClient:
|
|
15
15
|
"""
|
|
16
16
|
The main client class for the Scorb API.
|
|
@@ -18,29 +18,34 @@ class ScorbApiClient:
|
|
|
18
18
|
It provides methods to authenticate, get and set services required by the endpoints,
|
|
19
19
|
and get an endpoint instance by name.
|
|
20
20
|
"""
|
|
21
|
-
def __init__( self, company: str, app_name:str) -> None:
|
|
22
|
-
self.header_auth = Authorization(company=company, app_name=app_name).generate_authorization_header()
|
|
23
21
|
|
|
24
|
-
def
|
|
22
|
+
def __init__(
|
|
23
|
+
self, company: str, app_name: str, username: str, password: str
|
|
24
|
+
) -> None:
|
|
25
|
+
self.header_auth = Authorization(
|
|
26
|
+
company=company, app_name=app_name, username=username, password=password
|
|
27
|
+
).generate_authorization_header()
|
|
28
|
+
|
|
29
|
+
def globais(self) -> Globais:
|
|
25
30
|
return Globais(self.header_auth)
|
|
26
|
-
|
|
27
|
-
def entidades_de_cenario(self)-> EntidadesDeCenario:
|
|
31
|
+
|
|
32
|
+
def entidades_de_cenario(self) -> EntidadesDeCenario:
|
|
28
33
|
return EntidadesDeCenario(self.header_auth)
|
|
29
|
-
|
|
30
|
-
def entidades_customizadas(self)-> EntidadesCustomizadas:
|
|
34
|
+
|
|
35
|
+
def entidades_customizadas(self) -> EntidadesCustomizadas:
|
|
31
36
|
return EntidadesCustomizadas(self.header_auth)
|
|
32
|
-
|
|
33
|
-
def tabelas_customizadas(self)-> TabelasCustomizadas:
|
|
37
|
+
|
|
38
|
+
def tabelas_customizadas(self) -> TabelasCustomizadas:
|
|
34
39
|
return TabelasCustomizadas(self.header_auth)
|
|
35
40
|
|
|
36
41
|
def inventarios(self) -> Inventario:
|
|
37
42
|
return Inventario(self.header_auth)
|
|
38
|
-
|
|
39
|
-
def reports(self)-> Reports:
|
|
43
|
+
|
|
44
|
+
def reports(self) -> Reports:
|
|
40
45
|
return Reports(self.header_auth)
|
|
41
|
-
|
|
46
|
+
|
|
47
|
+
|
|
42
48
|
__doc__ = """
|
|
43
49
|
**ScorbApiClient** is a python package to providing
|
|
44
50
|
methods to use Scorb rest api.
|
|
45
51
|
"""
|
|
46
|
-
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"""This module handles authorization into Tutto API."""
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
from scorb_api.helpers.http import HTTPRequest
|
|
4
4
|
import asyncio
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
class Authorization:
|
|
7
|
-
def __init__(
|
|
8
|
+
def __init__(
|
|
9
|
+
self, company: str, app_name: str, username: str, password: str
|
|
10
|
+
) -> None:
|
|
8
11
|
self.__http_client = HTTPRequest()
|
|
9
12
|
self.company = company
|
|
10
13
|
self.app_name = app_name
|
|
14
|
+
self.username = username
|
|
15
|
+
self.password = password
|
|
11
16
|
self.token = None
|
|
12
17
|
|
|
13
18
|
def __get_authentication_body(self) -> dict:
|
|
14
19
|
return {
|
|
15
20
|
"grant_type": "password",
|
|
16
|
-
"username":
|
|
17
|
-
"password":
|
|
21
|
+
"username": self.username,
|
|
22
|
+
"password": self.password,
|
|
18
23
|
}
|
|
19
|
-
|
|
24
|
+
|
|
20
25
|
def __request_token(self) -> dict:
|
|
21
26
|
self.token = asyncio.run(
|
|
22
27
|
self.__http_client.request(
|
|
@@ -26,7 +31,7 @@ class Authorization:
|
|
|
26
31
|
parameters={"empresa": self.company, "app": self.app_name},
|
|
27
32
|
)
|
|
28
33
|
).get("access_token")
|
|
29
|
-
|
|
34
|
+
|
|
30
35
|
def generate_authorization_header(self) -> dict:
|
|
31
36
|
self.__request_token()
|
|
32
37
|
if not self.token:
|
|
@@ -7,26 +7,28 @@ class Report(Endpoint):
|
|
|
7
7
|
super().__init__(header_auth=header_auth)
|
|
8
8
|
self.base_url = f"/api/SCORC/crud/{report_name}"
|
|
9
9
|
|
|
10
|
-
def read(self):
|
|
11
|
-
response = self.__request_report_generation()
|
|
10
|
+
def read(self, output_format="2"):
|
|
11
|
+
response = self.__request_report_generation(output_format=output_format)
|
|
12
12
|
report_status_url = response["jobStatusUrl"]
|
|
13
13
|
report_result_url = response["jobResultUrl"]
|
|
14
14
|
is_report_completed = False
|
|
15
15
|
while not is_report_completed:
|
|
16
16
|
report_status = asyncio.run(self.http_request.request(
|
|
17
|
-
report_status_url, "get", headers=self.header_auth
|
|
17
|
+
report_status_url, "get", headers=self.header_auth,
|
|
18
18
|
))
|
|
19
19
|
sleep(10)
|
|
20
20
|
is_report_completed = report_status["Completed"]
|
|
21
21
|
report_data = asyncio.run(self.http_request.request(
|
|
22
|
-
report_result_url, "get", headers=self.header_auth
|
|
22
|
+
report_result_url, "get", headers=self.header_auth,
|
|
23
23
|
))
|
|
24
24
|
return report_data["Items"]
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
def __request_report_generation(self):
|
|
27
|
+
def __request_report_generation(self, output_format="2"):
|
|
28
28
|
return asyncio.run(
|
|
29
29
|
self.http_request.request(
|
|
30
|
-
f"{self.base_url}/read-async", "post", headers=self.header_auth
|
|
30
|
+
f"{self.base_url}/read-async", "post", headers=self.header_auth,
|
|
31
|
+
json={"outputFormat": output_format}
|
|
32
|
+
|
|
31
33
|
)
|
|
32
34
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_customizadas/__init__.py
RENAMED
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/cenario_visao.py
RENAMED
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/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.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/conta_contabil.py
RENAMED
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/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.1.8 → scorb_api-0.2.0}/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.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/entidade_de_cenario/plano_contas.py
RENAMED
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/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.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/atributo_customizado.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/inventario_template.py
RENAMED
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/projector_template.py
RENAMED
|
File without changes
|
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/tabela_customizada.py
RENAMED
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/globais/validation_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
{scorb_api-0.1.8 → scorb_api-0.2.0}/scorb_api/models/endpoints/tabelas_customizadas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|