core-https 1.0.1__tar.gz → 1.0.3__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.
- {core-https-1.0.1 → core_https-1.0.3}/PKG-INFO +4 -4
- {core-https-1.0.1 → core_https-1.0.3}/core_https/__init__.py +4 -4
- {core-https-1.0.1 → core_https-1.0.3}/core_https/decorators/response_wrapper.py +6 -6
- {core-https-1.0.1 → core_https-1.0.3}/core_https/exceptions.py +2 -2
- core-https-1.0.1/core_https/requesters/urllib3.py → core_https-1.0.3/core_https/requesters/url_lib3.py +3 -7
- {core-https-1.0.1 → core_https-1.0.3}/core_https.egg-info/PKG-INFO +4 -4
- {core-https-1.0.1 → core_https-1.0.3}/core_https.egg-info/SOURCES.txt +1 -1
- core_https-1.0.3/core_https.egg-info/requires.txt +4 -0
- {core-https-1.0.1 → core_https-1.0.3}/pyproject.toml +4 -4
- core-https-1.0.1/core_https.egg-info/requires.txt +0 -5
- {core-https-1.0.1 → core_https-1.0.3}/LICENSE +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/README.md +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/core_https/decorators/__init__.py +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/core_https/requesters/__init__.py +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/core_https/requesters/base.py +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/core_https.egg-info/dependency_links.txt +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/core_https.egg-info/top_level.txt +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/setup.cfg +0 -0
- {core-https-1.0.1 → core_https-1.0.3}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: core-https
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: This project/library contains common elements related to HTTP & API services...
|
|
5
5
|
Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
|
|
6
6
|
Maintainer: Alejandro Cora González
|
|
@@ -11,14 +11,14 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Classifier: Intended Audience :: Developers
|
|
15
16
|
Classifier: Topic :: Utilities
|
|
16
17
|
Requires-Python: >=3.9
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: core-tests==1.0.
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist: urllib3==1.26.16
|
|
20
|
+
Requires-Dist: core-tests==1.0.3
|
|
21
|
+
Requires-Dist: urllib3==2.2.3
|
|
22
22
|
Provides-Extra: test
|
|
23
23
|
|
|
24
24
|
# core-https
|
|
@@ -8,11 +8,11 @@ class StatusInfo(StrEnum):
|
|
|
8
8
|
StatusInfo is a literal representation of the response depending on
|
|
9
9
|
the status_code received...
|
|
10
10
|
|
|
11
|
-
* success: is for
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* success: is for HTTP statuses 1XX, 2XX and 3XX.
|
|
12
|
+
* error: is for HTTP statuses from 400 to 499.
|
|
13
|
+
* fail: is for HTTP statuses from 500 to 599.
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
SUCCESS = "success"
|
|
17
17
|
ERROR = "error"
|
|
18
|
-
|
|
18
|
+
FAILURE = "failure"
|
|
@@ -19,7 +19,7 @@ def wrapp_response(fnc: Callable[..., Tuple[HTTPStatus, Any]]):
|
|
|
19
19
|
Response payload:
|
|
20
20
|
{
|
|
21
21
|
"code": 2XX | 4XX | 5XX,
|
|
22
|
-
"status": "success" | "error" | "
|
|
22
|
+
"status": "success" | "error" | "failure",
|
|
23
23
|
"result": ...
|
|
24
24
|
"error": ...,
|
|
25
25
|
}
|
|
@@ -31,15 +31,15 @@ def wrapp_response(fnc: Callable[..., Tuple[HTTPStatus, Any]]):
|
|
|
31
31
|
- 5XX -> For unmanaged or internal server errors.
|
|
32
32
|
|
|
33
33
|
status:
|
|
34
|
-
Contains the text: "success", "
|
|
35
|
-
response values from 500
|
|
34
|
+
Contains the text: "success", "failure", or "error". Where "failure" is for HTTP status
|
|
35
|
+
response values from 500 to 599, "error" is for statuses from 400 to 499, and "success" is
|
|
36
36
|
for everything else (e.g. 1XX, 2XX and 3XX responses).
|
|
37
37
|
|
|
38
38
|
result:
|
|
39
39
|
Contains the result.
|
|
40
40
|
|
|
41
41
|
error:
|
|
42
|
-
Only used for "
|
|
42
|
+
Only used for "failure" and "error" statuses, and it contains the error information.
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
45
|
@wraps(fnc)
|
|
@@ -63,14 +63,14 @@ def wrapp_response(fnc: Callable[..., Tuple[HTTPStatus, Any]]):
|
|
|
63
63
|
except InternalServerError as error:
|
|
64
64
|
return {
|
|
65
65
|
"code": error.status_code,
|
|
66
|
-
"status": StatusInfo.
|
|
66
|
+
"status": StatusInfo.FAILURE,
|
|
67
67
|
"error": error.get_error_info()
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
except Exception as error:
|
|
71
71
|
return {
|
|
72
72
|
"code": HTTPStatus.INTERNAL_SERVER_ERROR,
|
|
73
|
-
"status": StatusInfo.
|
|
73
|
+
"status": StatusInfo.FAILURE,
|
|
74
74
|
"error": {
|
|
75
75
|
"type": error.__class__.__name__,
|
|
76
76
|
"details": str(error)
|
|
@@ -4,7 +4,7 @@ from typing import Dict
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class InternalServerError(Exception):
|
|
7
|
-
""" Base class for exceptions on the project """
|
|
7
|
+
""" Base class for exceptions on the project and unhandled errors """
|
|
8
8
|
|
|
9
9
|
def __init__(self, status_code: int, details: str, *args):
|
|
10
10
|
super(InternalServerError, self).__init__(*args)
|
|
@@ -23,4 +23,4 @@ class AuthorizationException(InternalServerError):
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ServiceException(InternalServerError):
|
|
26
|
-
""" Exception caused for
|
|
26
|
+
""" Exception caused for handled errors within the service """
|
|
@@ -22,10 +22,6 @@ class Urllib3Requester(Requester):
|
|
|
22
22
|
retries: Retry = False, **kwargs) -> HTTPResponse:
|
|
23
23
|
|
|
24
24
|
return cls._http.request(
|
|
25
|
-
method=method,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
fields=fields,
|
|
29
|
-
timeout=timeout,
|
|
30
|
-
retries=retries,
|
|
31
|
-
**kwargs)
|
|
25
|
+
method=method, url=url, headers=headers,
|
|
26
|
+
fields=fields, timeout=timeout,
|
|
27
|
+
retries=retries, **kwargs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: core-https
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: This project/library contains common elements related to HTTP & API services...
|
|
5
5
|
Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
|
|
6
6
|
Maintainer: Alejandro Cora González
|
|
@@ -11,14 +11,14 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Classifier: Intended Audience :: Developers
|
|
15
16
|
Classifier: Topic :: Utilities
|
|
16
17
|
Requires-Python: >=3.9
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: core-tests==1.0.
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist: urllib3==1.26.16
|
|
20
|
+
Requires-Dist: core-tests==1.0.3
|
|
21
|
+
Requires-Dist: urllib3==2.2.3
|
|
22
22
|
Provides-Extra: test
|
|
23
23
|
|
|
24
24
|
# core-https
|
|
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
|
|
|
9
9
|
[project]
|
|
10
10
|
name = "core-https"
|
|
11
11
|
description = "This project/library contains common elements related to HTTP & API services..."
|
|
12
|
-
version = "1.0.
|
|
12
|
+
version = "1.0.3"
|
|
13
13
|
|
|
14
14
|
authors = [
|
|
15
15
|
{name = "Alejandro Cora González", email = "alek.cora.glez@gmail.com"}
|
|
@@ -30,14 +30,14 @@ classifiers = [
|
|
|
30
30
|
"Programming Language :: Python :: 3",
|
|
31
31
|
"Programming Language :: Python :: 3.9",
|
|
32
32
|
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
33
34
|
"Intended Audience :: Developers",
|
|
34
35
|
"Topic :: Utilities"
|
|
35
36
|
]
|
|
36
37
|
|
|
37
38
|
dependencies = [
|
|
38
|
-
"core-tests==1.0.
|
|
39
|
-
"
|
|
40
|
-
"urllib3==1.26.16"
|
|
39
|
+
"core-tests==1.0.3",
|
|
40
|
+
"urllib3==2.2.3"
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
[project.urls]
|
|
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
|