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.
Files changed (20) hide show
  1. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/PKG-INFO +1 -1
  2. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/pyproject.toml +1 -1
  3. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/__init__.py +9 -4
  4. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/exceptions.py +8 -1
  5. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/PKG-INFO +1 -1
  6. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/README.md +0 -0
  7. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/setup.cfg +0 -0
  8. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/__init__.py +0 -0
  9. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/classes.py +0 -0
  10. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/github.py +0 -0
  11. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/gitlab.py +0 -0
  12. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/issues.py +0 -0
  13. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/licenses.py +0 -0
  14. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/core/messages.py +0 -0
  15. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity/socketcli.py +0 -0
  16. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/SOURCES.txt +0 -0
  17. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/dependency_links.txt +0 -0
  18. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/entry_points.txt +0 -0
  19. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/requires.txt +0 -0
  20. {socketsecurity-0.0.64 → socketsecurity-0.0.66}/socketsecurity.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 0.0.64
3
+ Version: 0.0.66
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Author-email: Douglas Coburn <douglas@socket.dev>
6
6
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "socketsecurity"
7
- version = "0.0.64"
7
+ version = "0.0.66"
8
8
  requires-python = ">= 3.9"
9
9
  dependencies = [
10
10
  'requests',
@@ -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 APIFailure, APIKeyMissing, APIAccessDenied, APIInsufficientQuota, APIResourceNotFound
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.64'
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': 'SocketPythonScript/0.0.1',
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": 524,
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 0.0.64
3
+ Version: 0.0.66
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Author-email: Douglas Coburn <douglas@socket.dev>
6
6
  Maintainer-email: Douglas Coburn <douglas@socket.dev>