core-https 1.1.3__tar.gz → 1.1.5__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.1.3 → core_https-1.1.5}/PKG-INFO +1 -1
- core_https-1.1.5/core_https/exceptions.py +58 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https.egg-info/PKG-INFO +1 -1
- {core_https-1.1.3 → core_https-1.1.5}/pyproject.toml +1 -1
- core_https-1.1.3/core_https/exceptions.py +0 -26
- {core_https-1.1.3 → core_https-1.1.5}/LICENSE +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/README.md +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https/__init__.py +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https/requesters/__init__.py +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https/requesters/base.py +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https/requesters/url_lib3.py +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https/utils.py +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https.egg-info/SOURCES.txt +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https.egg-info/dependency_links.txt +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https.egg-info/requires.txt +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/core_https.egg-info/top_level.txt +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/setup.cfg +0 -0
- {core_https-1.1.3 → core_https-1.1.5}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: core-https
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.5
|
|
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
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from typing import Dict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class InternalServerError(Exception):
|
|
7
|
+
""" Base class for exceptions on the project and unhandled errors """
|
|
8
|
+
|
|
9
|
+
def __init__(self, status_code: int, details: str, *args):
|
|
10
|
+
super(InternalServerError, self).__init__(*args)
|
|
11
|
+
self.status_code = status_code
|
|
12
|
+
self.details = details
|
|
13
|
+
|
|
14
|
+
def get_error_info(self) -> Dict:
|
|
15
|
+
return {
|
|
16
|
+
"type": self.__class__.__name__,
|
|
17
|
+
"details": self.details
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ServiceException(InternalServerError):
|
|
22
|
+
""" Exception caused for handled errors within the service """
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AuthenticationException(ServiceException):
|
|
26
|
+
""" Exception caused for authentication [401] issues """
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
status_code: int = 403,
|
|
31
|
+
details: str = "Unauthorized"
|
|
32
|
+
) -> None:
|
|
33
|
+
super().__init__(status_code=status_code, details=details)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AuthorizationException(ServiceException):
|
|
37
|
+
""" Exception caused for authorization [403] issues """
|
|
38
|
+
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
status_code: int = 403,
|
|
42
|
+
details: str = "Forbidden"
|
|
43
|
+
) -> None:
|
|
44
|
+
super().__init__(status_code=status_code, details=details)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class RateLimitException(ServiceException):
|
|
48
|
+
"""
|
|
49
|
+
Exception caused [429] when a client has sent too many requests
|
|
50
|
+
to a server within a given time frame.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
status_code: int = 429,
|
|
56
|
+
details: str = "Too Many Requests"
|
|
57
|
+
) -> None:
|
|
58
|
+
super().__init__(status_code=status_code, details=details)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: core-https
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.5
|
|
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
|
|
@@ -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.1.
|
|
12
|
+
version = "1.1.5"
|
|
13
13
|
|
|
14
14
|
authors = [
|
|
15
15
|
{name = "Alejandro Cora González", email = "alek.cora.glez@gmail.com"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
from typing import Dict
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class InternalServerError(Exception):
|
|
7
|
-
""" Base class for exceptions on the project and unhandled errors """
|
|
8
|
-
|
|
9
|
-
def __init__(self, status_code: int, details: str, *args):
|
|
10
|
-
super(InternalServerError, self).__init__(*args)
|
|
11
|
-
self.status_code = status_code
|
|
12
|
-
self.details = details
|
|
13
|
-
|
|
14
|
-
def get_error_info(self) -> Dict:
|
|
15
|
-
return {
|
|
16
|
-
"type": self.__class__.__name__,
|
|
17
|
-
"details": self.details
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class AuthorizationException(InternalServerError):
|
|
22
|
-
""" Exception caused for authentication (401, 403) issues """
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ServiceException(InternalServerError):
|
|
26
|
-
""" Exception caused for handled errors within the service """
|
|
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
|