attime-star-api-python-sdk 1.1.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.
@@ -0,0 +1,5 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Seu Nome
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: attime-star-api-python-sdk
3
+ Version: 1.1.0
4
+ Summary: Client HTTP de comunicacao com a API da ATTime Star
5
+ Author-email: Filipe Coelho <filipe@fmconsult.com.br>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Seu Nome
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
11
+
12
+ Project-URL: Homepage, https://github.com/seuuser/minha-biblioteca
13
+ Project-URL: Bug Tracker, https://github.com/seuuser/minha-biblioteca/issues
14
+ Keywords: sdk,api,attime,star
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
File without changes
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "attime-star-api-python-sdk"
7
+ version = "1.1.0"
8
+ description = "Client HTTP de comunicacao com a API da ATTime Star"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {file = "LICENSE"}
12
+ authors = [
13
+ {name = "Filipe Coelho", email = "filipe@fmconsult.com.br"},
14
+ ]
15
+ keywords = ["sdk", "api", "attime", "star"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+
22
+ dependencies = []
23
+
24
+ [project.urls]
25
+ "Homepage" = "https://github.com/seuuser/minha-biblioteca"
26
+ "Bug Tracker" = "https://github.com/seuuser/minha-biblioteca/issues"
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["src"]
30
+ namespaces = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,45 @@
1
+ import os, jsonpickle
2
+ from http import HTTPMethod
3
+ from fmconsult.http.api import ApiBase
4
+ from fmconsult.utils.url import UrlUtil
5
+
6
+ class ATTimeStarApi(ApiBase):
7
+
8
+ def __init__(self):
9
+ try:
10
+ self.api_environment = os.environ['attime.star.api.environment']
11
+ self.api_company_name = os.environ['attime.star.api.company.name']
12
+ self.api_enrollment = os.environ['attime.star.api.enrollment']
13
+ self.api_password = os.environ['attime.star.api.password']
14
+
15
+ api_sandbox_base_url = 'https://starbackhom.attime.inf.br'
16
+ api_live_base_url = 'https://starback.attime.com.br'
17
+
18
+ get_base_url = lambda env: api_live_base_url if env == 'live' else api_sandbox_base_url
19
+
20
+ self.base_url = get_base_url(self.api_environment)
21
+ self.headers = {
22
+ 'Empresa': self.api_company_name
23
+ }
24
+
25
+ self.__login()
26
+ except:
27
+ raise
28
+ def __login(self):
29
+ try:
30
+ res = self.call_request(
31
+ http_method = HTTPMethod.POST,
32
+ request_url = UrlUtil().make_url(self.base_url, ['rss','ARSA0000','Login']),
33
+ payload = {
34
+ 'matricula': self.api_enrollment,
35
+ 'senha': self.api_password
36
+ }
37
+ )
38
+ res = jsonpickle.decode(res)
39
+ if not('codigo' in res):
40
+ self.access_token = res['dados']['token']
41
+ self.headers['Authorization'] = f'Bearer {self.access_token}'
42
+ else:
43
+ raise Exception(res['mensagem'])
44
+ except:
45
+ raise
@@ -0,0 +1,30 @@
1
+ import logging, jsonpickle
2
+ from http import HTTPMethod
3
+ from fmconsult.utils.url import UrlUtil
4
+ from attime.star.api import ATTimeStarApi
5
+ from attime.star.dtos.infocar import Veiculo
6
+
7
+ class InfoCarApi(ATTimeStarApi):
8
+
9
+ def get_vehicle_data(self, PlacaChassi: str, FuncionarioCnpjCpf: str):
10
+ logging.info(f'getting vehicle data by plate in InfoCar API...')
11
+ try:
12
+ url = UrlUtil().make_url(self.base_url, ['btc', 'ABTC0003', 'ApiInfoCar', 'Placa'])
13
+ res = self.call_request(
14
+ http_method = HTTPMethod.GET,
15
+ request_url = url,
16
+ params = {
17
+ 'PlacaChassi': PlacaChassi,
18
+ 'FuncionarioCnpjCpf': FuncionarioCnpjCpf
19
+ }
20
+ )
21
+ res = jsonpickle.decode(res)
22
+
23
+ if 'dados' not in res:
24
+ raise Exception(res.get('mensagem', 'Erro desconhecido'))
25
+
26
+ items = [Veiculo(**item) for item in res['dados']]
27
+
28
+ return items
29
+ except:
30
+ raise
@@ -0,0 +1,43 @@
1
+ from dataclasses import dataclass, asdict
2
+ from typing import Optional
3
+
4
+ @dataclass
5
+ class Veiculo:
6
+ placa: str
7
+ codigoFipe: str
8
+ apiExternaCodigo: str
9
+ fonteCodigoSequencial: int
10
+ vrmFonte: str
11
+ vrmTipo: str
12
+ chassi: str
13
+ modelo: str
14
+ marca: str
15
+ anoFabricacao: int
16
+ anoModelo: int
17
+ valor: float
18
+ cor: str
19
+ combustivel: str
20
+ uf: str
21
+ municipio: str
22
+ tipoVeiculo: str
23
+ motor: str
24
+ numeroCaixaCambio: Optional[str] = None
25
+ numeroEixoTraseiroDiferencial: Optional[str] = None
26
+ procedencia: Optional[str] = None
27
+ situacaoChassi: Optional[str] = None
28
+ capacidadeDeCarga: Optional[str] = None
29
+ potencia: Optional[str] = None
30
+ numeroCilindradas: Optional[int] = None
31
+ capacidadeDePassageiros: Optional[int] = None
32
+ tipoMontagem: Optional[str] = None
33
+ quantidadeDeEixos: Optional[int] = None
34
+ cmt: Optional[str] = None
35
+ pbt: Optional[str] = None
36
+ carroceria: Optional[str] = None
37
+ numeroCarroceria: Optional[str] = None
38
+ descricao: Optional[str] = None
39
+ manutencaoUsuarioCpf: Optional[str] = None
40
+ manutencaoUsuarioDataHora: Optional[str] = None
41
+
42
+ def to_dict(self):
43
+ return asdict(self)
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: attime-star-api-python-sdk
3
+ Version: 1.1.0
4
+ Summary: Client HTTP de comunicacao com a API da ATTime Star
5
+ Author-email: Filipe Coelho <filipe@fmconsult.com.br>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Seu Nome
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy...
11
+
12
+ Project-URL: Homepage, https://github.com/seuuser/minha-biblioteca
13
+ Project-URL: Bug Tracker, https://github.com/seuuser/minha-biblioteca/issues
14
+ Keywords: sdk,api,attime,star
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/attime/star/api.py
5
+ src/attime/star/apis/__init__.py
6
+ src/attime/star/apis/infocar.py
7
+ src/attime/star/dtos/__init__.py
8
+ src/attime/star/dtos/infocar.py
9
+ src/attime_star_api_python_sdk.egg-info/PKG-INFO
10
+ src/attime_star_api_python_sdk.egg-info/SOURCES.txt
11
+ src/attime_star_api_python_sdk.egg-info/dependency_links.txt
12
+ src/attime_star_api_python_sdk.egg-info/top_level.txt