getrak-python-sdk 1.1.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
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.
- getrak/apis/recebidos.py +5 -1
- getrak/errors.py +4 -0
- {getrak_python_sdk-1.1.0.dist-info → getrak_python_sdk-1.2.0.dist-info}/METADATA +1 -1
- {getrak_python_sdk-1.1.0.dist-info → getrak_python_sdk-1.2.0.dist-info}/RECORD +7 -7
- {getrak_python_sdk-1.1.0.dist-info → getrak_python_sdk-1.2.0.dist-info}/WHEEL +0 -0
- {getrak_python_sdk-1.1.0.dist-info → getrak_python_sdk-1.2.0.dist-info}/licenses/LICENSE +0 -0
- {getrak_python_sdk-1.1.0.dist-info → getrak_python_sdk-1.2.0.dist-info}/top_level.txt +0 -0
getrak/apis/recebidos.py
CHANGED
|
@@ -6,7 +6,7 @@ import jsonpickle
|
|
|
6
6
|
from http import HTTPMethod
|
|
7
7
|
from fmconsult.utils.url import UrlUtil
|
|
8
8
|
from getrak.api import GetrakApi
|
|
9
|
-
from getrak.errors import GetrakError, InvalidVehicleId
|
|
9
|
+
from getrak.errors import GetrakError, InvalidVehicleId, VehicleNotFound
|
|
10
10
|
|
|
11
11
|
VEHICLE_ID_RE = re.compile(r"^[A-Za-z0-9_-]+$")
|
|
12
12
|
|
|
@@ -34,6 +34,10 @@ class Recebidos(GetrakApi):
|
|
|
34
34
|
body = json.loads(raw)
|
|
35
35
|
except ValueError:
|
|
36
36
|
raise GetrakError("resposta de recebidos não é JSON") from None
|
|
37
|
+
if isinstance(body, dict):
|
|
38
|
+
message = body.get("error") if isinstance(body.get("error"), str) else ""
|
|
39
|
+
if "não encontrado" in message.casefold():
|
|
40
|
+
raise VehicleNotFound(message)
|
|
37
41
|
if not isinstance(body, list):
|
|
38
42
|
raise GetrakError("resposta de recebidos não é uma lista")
|
|
39
43
|
if not all(isinstance(item, dict) for item in body):
|
getrak/errors.py
CHANGED
|
@@ -6,5 +6,9 @@ class InvalidVehicleId(GetrakError):
|
|
|
6
6
|
pass
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
class VehicleNotFound(GetrakError):
|
|
10
|
+
"""A conta não tem esse veículo. Não há lista de posições para gravar."""
|
|
11
|
+
|
|
12
|
+
|
|
9
13
|
class AuthenticationFailed(GetrakError):
|
|
10
14
|
"""A Getrak recusou as credenciais. Vale para as chamadas seguintes desta instância."""
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
getrak/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
getrak/api.py,sha256=sRhJdXUknljeuvEsJPO1gTBscoUlm0KD_NwS-9BbhyA,5890
|
|
3
|
-
getrak/errors.py,sha256=
|
|
3
|
+
getrak/errors.py,sha256=mobmS8zzjzL1giAlj8o6OTX21gkz1OVbmd2n3CMNZOc,381
|
|
4
4
|
getrak/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
getrak/apis/localizacoes.py,sha256=UuRqEHRMecUQRdSUVq7gRXLPeKe4IZ0byYFlGbDn-6U,654
|
|
6
|
-
getrak/apis/recebidos.py,sha256=
|
|
6
|
+
getrak/apis/recebidos.py,sha256=pUWFyXiu-JWy0fykEKBETA7DTGM5jYbpwuqXsAQoZz0,1792
|
|
7
7
|
getrak/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
getrak/database/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
getrak/database/models/dataexplained.py,sha256=9qjXvccphYUVK0LTNvxjMXRzMOsynbMmcYDkaK41Tdo,212
|
|
10
10
|
getrak/database/models/vehicle.py,sha256=04SVD0TVwnF-4bLbMmdN0dKd9KboMa1-KfxkJ8Fwpv8,2941
|
|
11
|
-
getrak_python_sdk-1.
|
|
12
|
-
getrak_python_sdk-1.
|
|
13
|
-
getrak_python_sdk-1.
|
|
14
|
-
getrak_python_sdk-1.
|
|
15
|
-
getrak_python_sdk-1.
|
|
11
|
+
getrak_python_sdk-1.2.0.dist-info/licenses/LICENSE,sha256=YZjQnFjzXGFa0D3iCQkNDwGBNuTGJREkRmItGX1B3YM,122
|
|
12
|
+
getrak_python_sdk-1.2.0.dist-info/METADATA,sha256=r_VOClVT49asa7dbWvWf0-6qDpwFfA4mT6D2PSR8Ku4,849
|
|
13
|
+
getrak_python_sdk-1.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
14
|
+
getrak_python_sdk-1.2.0.dist-info/top_level.txt,sha256=FTZAzVY_kDvwVRXKSWipeV7H-1ztlyuOMVHhyCEkQO0,7
|
|
15
|
+
getrak_python_sdk-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|