socketsecurity 0.0.64__tar.gz → 0.0.66__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.
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/PKG-INFO +1 -1
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/pyproject.toml +1 -1
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/__init__.py +9 -4
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/exceptions.py +8 -1
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/PKG-INFO +1 -1
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/README.md +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/setup.cfg +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/__init__.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/github.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/gitlab.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/issues.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/socketcli.py +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/SOURCES.txt +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/top_level.txt +0 -0
|
@@ -3,7 +3,9 @@ import requests
|
|
|
3
3
|
from urllib.parse import urlencode
|
|
4
4
|
import base64
|
|
5
5
|
import json
|
|
6
|
-
from socketsecurity.core.exceptions import
|
|
6
|
+
from socketsecurity.core.exceptions import (
|
|
7
|
+
APIFailure, APIKeyMissing, APIAccessDenied, APIInsufficientQuota, APIResourceNotFound, APICloudflareError
|
|
8
|
+
)
|
|
7
9
|
from socketsecurity.core.licenses import Licenses
|
|
8
10
|
from socketsecurity.core.issues import AllIssues
|
|
9
11
|
from socketsecurity.core.classes import (
|
|
@@ -23,7 +25,7 @@ import time
|
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
__author__ = 'socket.dev'
|
|
26
|
-
__version__ = '0.0.
|
|
28
|
+
__version__ = '0.0.66'
|
|
27
29
|
__all__ = [
|
|
28
30
|
"Core",
|
|
29
31
|
"log",
|
|
@@ -79,7 +81,7 @@ def do_request(
|
|
|
79
81
|
if headers is None:
|
|
80
82
|
headers = {
|
|
81
83
|
'Authorization': f"Basic {encoded_key}",
|
|
82
|
-
'User-Agent': '
|
|
84
|
+
'User-Agent': f'SocketPythonCLI/{__version__}',
|
|
83
85
|
"accept": "application/json"
|
|
84
86
|
}
|
|
85
87
|
url = f"{api_url}/{path}"
|
|
@@ -110,9 +112,12 @@ def do_request(
|
|
|
110
112
|
raise APIResourceNotFound(f"Path not found {path}")
|
|
111
113
|
elif response.status_code == 429:
|
|
112
114
|
raise APIInsufficientQuota("Insufficient quota for API route")
|
|
115
|
+
elif response.status_code == 524:
|
|
116
|
+
raise APICloudflareError(response.text)
|
|
113
117
|
else:
|
|
114
118
|
msg = {
|
|
115
|
-
"status_code":
|
|
119
|
+
"status_code": response.status_code,
|
|
120
|
+
"error": response.text,
|
|
116
121
|
"UnexpectedError": "There was an unexpected error using the API"
|
|
117
122
|
}
|
|
118
123
|
raise APIFailure(msg)
|
|
@@ -3,12 +3,19 @@ __all__ = [
|
|
|
3
3
|
"APIKeyMissing",
|
|
4
4
|
"APIAccessDenied",
|
|
5
5
|
"APIInsufficientQuota",
|
|
6
|
-
"APIResourceNotFound"
|
|
6
|
+
"APIResourceNotFound",
|
|
7
|
+
"APICloudflareError"
|
|
7
8
|
]
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
class APICloudflareError(Exception):
|
|
12
|
+
"""Raised when there is an error using the API related to cloudflare"""
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
class APIKeyMissing(Exception):
|
|
11
17
|
"""Raised when the api key is not passed and the headers are empty"""
|
|
18
|
+
pass
|
|
12
19
|
|
|
13
20
|
|
|
14
21
|
class APIFailure(Exception):
|
|
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
|
{socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|