fmconsult-utils-python-sdk 2.0.4__tar.gz → 2.0.6__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.
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/PKG-INFO +1 -1
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/pyproject.toml +1 -1
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/http/api.py +17 -31
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult_utils_python_sdk.egg-info/PKG-INFO +1 -1
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/LICENSE +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/README.md +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/setup.cfg +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/auth/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/auth/decorator.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/auth/profile_builder.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/auth/token_manager.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/connection.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/models/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/models/application.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/models/base.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/models/city.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/models/country.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/database/models/state.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/decorators/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/decorators/auth.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/authorization.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/bad_request_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/conflict_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/forbidden_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/not_found_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/not_implemented_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/unauthorized_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/exceptions/unavailable_exception.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/http/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/__init__.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/cast.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/cnpj.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/configs.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/cpf.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/date.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/enum.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/haversine.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/object.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/pagination.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/string.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/url.py +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult_utils_python_sdk.egg-info/SOURCES.txt +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult_utils_python_sdk.egg-info/dependency_links.txt +0 -0
- {fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult_utils_python_sdk.egg-info/top_level.txt +0 -0
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/http/api.py
RENAMED
|
@@ -15,17 +15,7 @@ class ContentType(Enum):
|
|
|
15
15
|
|
|
16
16
|
class ApiBase(object):
|
|
17
17
|
def __init__(self, additional_headers=None):
|
|
18
|
-
self.__start_debugger()
|
|
19
18
|
self.__define_headers(additional_headers)
|
|
20
|
-
|
|
21
|
-
def __start_debugger(self):
|
|
22
|
-
self.logging_level = None
|
|
23
|
-
try:
|
|
24
|
-
self.cph = ConfigPropertiesHelper()
|
|
25
|
-
self.logging_level = self.cph.get_property_value('SELF', 'self.logging.level')
|
|
26
|
-
except:
|
|
27
|
-
logging.warning('Logging level not found in config file')
|
|
28
|
-
pass
|
|
29
19
|
|
|
30
20
|
def __define_headers(self, additional_headers=None):
|
|
31
21
|
self.headers = {
|
|
@@ -45,39 +35,37 @@ class ApiBase(object):
|
|
|
45
35
|
res.raise_for_status() # Verifica se ocorreu algum erro HTTP
|
|
46
36
|
return res
|
|
47
37
|
except (ConnectionError, ChunkedEncodingError) as e:
|
|
38
|
+
logging.error(e)
|
|
48
39
|
logging.error(f"Connection error occurred: {e}. Retrying {attempt + 1}/{max_retries}...")
|
|
49
40
|
if attempt == max_retries - 1:
|
|
50
41
|
raise # Lança a exceção se o limite de tentativas for atingido
|
|
51
42
|
except requests.exceptions.RequestException as e:
|
|
43
|
+
logging.error(e)
|
|
52
44
|
logging.error(f"An error occurred: {e}")
|
|
53
45
|
raise # Lança qualquer outra exceção que não for de conexão
|
|
54
46
|
|
|
55
47
|
def call_request(self, http_method:HTTPMethod, request_url, params=None, payload=None, content_type:ContentType=ContentType.APPLICATION_JSON):
|
|
56
48
|
try:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
logging.info(request_url)
|
|
49
|
+
logging.info(f'{str(http_method).upper()} url:')
|
|
50
|
+
logging.info(request_url)
|
|
60
51
|
|
|
61
52
|
self.headers['Content-Type'] = content_type.value
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
logging.info(jsonpickle.encode(self.headers))
|
|
54
|
+
logging.info(f'{str(http_method).upper()} headers:')
|
|
55
|
+
logging.info(jsonpickle.encode(self.headers))
|
|
66
56
|
|
|
67
57
|
# Verifica se há parâmetros a serem enviados na URL
|
|
68
58
|
if not params is None:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
logging.info(jsonpickle.encode(params))
|
|
59
|
+
logging.info(f'{str(http_method).upper()} params:')
|
|
60
|
+
logging.info(jsonpickle.encode(params))
|
|
72
61
|
|
|
73
62
|
# Log do payload (apenas se for POST ou PUT)
|
|
74
63
|
if not payload is None:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
logging.info(payload)
|
|
64
|
+
logging.info(f'{str(http_method).upper()} payload:')
|
|
65
|
+
if content_type == ContentType.APPLICATION_JSON:
|
|
66
|
+
logging.info(jsonpickle.encode(payload))
|
|
67
|
+
else:
|
|
68
|
+
logging.info(payload)
|
|
81
69
|
|
|
82
70
|
# Configuração dos parâmetros para requisição
|
|
83
71
|
req_args = {
|
|
@@ -95,9 +83,8 @@ class ApiBase(object):
|
|
|
95
83
|
else:
|
|
96
84
|
req_args['data'] = payload
|
|
97
85
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
logging.info(req_args)
|
|
86
|
+
logging.info(f'request args:')
|
|
87
|
+
logging.info(req_args)
|
|
101
88
|
|
|
102
89
|
res = self.__make_request(req_args)
|
|
103
90
|
|
|
@@ -116,9 +103,8 @@ class ApiBase(object):
|
|
|
116
103
|
|
|
117
104
|
res = res.content.decode('utf-8')
|
|
118
105
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
logging.info(jsonpickle.encode(res))
|
|
106
|
+
logging.info(f'{str(http_method).upper()} response:')
|
|
107
|
+
logging.info(jsonpickle.encode(res))
|
|
122
108
|
|
|
123
109
|
return res
|
|
124
110
|
except UnavailableException as e:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/__init__.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/auth/__init__.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/http/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/cast.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/cnpj.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/configs.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/cpf.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/date.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/enum.py
RENAMED
|
File without changes
|
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/object.py
RENAMED
|
File without changes
|
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/string.py
RENAMED
|
File without changes
|
{fmconsult_utils_python_sdk-2.0.4 → fmconsult_utils_python_sdk-2.0.6}/src/fmconsult/utils/url.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|