socketdev 3.0.32__py3-none-any.whl → 3.1.0__py3-none-any.whl

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.
@@ -443,11 +443,20 @@ class SocketAlert:
443
443
 
444
444
  @classmethod
445
445
  def from_dict(cls, data: dict) -> "SocketAlert":
446
+ try:
447
+ category = SocketCategory(data["category"])
448
+ except ValueError:
449
+ log.warning(
450
+ "Unknown SocketCategory %r; falling back to MISCELLANEOUS. "
451
+ "Upgrade socketdev to pick up newer categories.",
452
+ data["category"],
453
+ )
454
+ category = SocketCategory.MISCELLANEOUS
446
455
  return cls(
447
456
  key=data["key"],
448
457
  type=data["type"],
449
458
  severity=SocketIssueSeverity(data["severity"]),
450
- category=SocketCategory(data["category"]),
459
+ category=category,
451
460
  file=data.get("file"),
452
461
  start=data.get("start"),
453
462
  end=data.get("end"),
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import urllib.parse
3
+ import warnings
3
4
  from socketdev.log import log
4
5
  from ..core.dedupe import Dedupe
5
6
 
@@ -8,8 +9,21 @@ class Purl:
8
9
  def __init__(self, api):
9
10
  self.api = api
10
11
 
11
- def post(self, license: str = "false", components: list = None, **kwargs) -> list:
12
- path = "purl?"
12
+ def post(
13
+ self,
14
+ license: str = "false",
15
+ components: list = None,
16
+ org_slug: str = None,
17
+ **kwargs,
18
+ ) -> list:
19
+ if org_slug is None:
20
+ warnings.warn(
21
+ "Calling purl.post() without org_slug uses the deprecated POST /v0/purl endpoint. "
22
+ "Pass org_slug to migrate to POST /v0/orgs/{org_slug}/purl.",
23
+ DeprecationWarning,
24
+ stacklevel=2,
25
+ )
26
+ path = f"orgs/{org_slug}/purl?" if org_slug else "purl?"
13
27
  if components is None:
14
28
  components = []
15
29
  purls = {"components": components}
socketdev/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "3.0.32"
1
+ __version__ = "3.1.0"
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketdev
3
- Version: 3.0.32
3
+ Version: 3.1.0
4
4
  Summary: Socket Security Python SDK
5
- Project-URL: Homepage, https://github.com/socketdev/socketdev
5
+ Project-URL: Homepage, https://github.com/SocketDev/socket-sdk-python
6
6
  Author-email: Douglas Coburn <douglas@socket.dev>
7
7
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
8
8
  License: MIT License
@@ -78,9 +78,11 @@ Supported Functions
78
78
  -------------------
79
79
 
80
80
 
81
- purl.post(license, components)
82
- """"""""""""""""""""""""""""""
83
- Retrieve the package information for a purl post
81
+ purl.post(license, components, org_slug=None)
82
+ """""""""""""""""""""""""""""""""""""""""""""
83
+ Retrieve package information for one or more PURLs. Pass ``org_slug`` to use the
84
+ current org-scoped endpoint. Omitting ``org_slug`` keeps the legacy deprecated
85
+ endpoint for backwards compatibility.
84
86
 
85
87
  **Usage:**
86
88
 
@@ -88,6 +90,7 @@ Retrieve the package information for a purl post
88
90
 
89
91
  from socketdev import socketdev
90
92
  socket = socketdev(token="REPLACE_ME")
93
+ org_slug = "your-org-slug"
91
94
  license = "true"
92
95
  components = [
93
96
  {
@@ -97,12 +100,13 @@ Retrieve the package information for a purl post
97
100
  "purl": "pkg:pypi/socketsecurity"
98
101
  }
99
102
  ]
100
- print(socket.purl.post(license, components))
103
+ print(socket.purl.post(license, components, org_slug=org_slug))
101
104
 
102
105
  **PARAMETERS:**
103
106
 
104
107
  - **license (str)** - The license parameter if enabled will show alerts and license information. If disabled will only show the basic package metadata and scores. Default is true
105
108
  - **components (array{dict})** - The components list of packages urls
109
+ - **org_slug (str, optional)** - Organization slug for the supported org-scoped PURL endpoint. If omitted, the SDK uses the deprecated legacy endpoint for backwards compatibility.
106
110
 
107
111
  export.cdx_bom(org_slug, id, query_params)
108
112
  """"""""""""""""""""""""""""""""""""""""""
@@ -1,7 +1,7 @@
1
1
  socketdev/__init__.py,sha256=mYuLIlXdU0uec1418LIw_oILBRh5DyWQDpWafaMa_AU,4484
2
2
  socketdev/exceptions.py,sha256=SNU1EgswGwnxI_Zmm325ruP6CFg5C4MsS1qxXWwBJqs,1120
3
3
  socketdev/log.py,sha256=AgEcsPN3y9U-fze8pTFvLigVvNob2vmNC-TkOOQkkeQ,90
4
- socketdev/version.py,sha256=prlgnkHaAXuZtTHjR_cA6ise50Co2m__lMUL5FvutP0,23
4
+ socketdev/version.py,sha256=YVoF76lT0p3dIsqphNnDWuqSia3gZP1S1eQYXZ9FbSE,22
5
5
  socketdev/alertfullscansearch/__init__.py,sha256=YwXrgnrI9z9rAexXFFmoXQcaQdGW47HRhQ58CQBCG3U,884
6
6
  socketdev/alerts/__init__.py,sha256=kGLCNXtXTRz3vl2s_bPQ7xuds_QGwNQnah1TfHzp2MU,846
7
7
  socketdev/alerttypes/__init__.py,sha256=W-m2D9VxbepSAUELJPmWmX40zksGZbQcSzwQ1kjlB1k,1169
@@ -17,14 +17,14 @@ socketdev/dependencies/__init__.py,sha256=zdAb0lMYF8tTHFWa9kGwz5dv4_Sp1UpzQseg_4
17
17
  socketdev/diffscans/__init__.py,sha256=ndsgyFmsvK29pJAEhZyBByZ9ampf1Ks6oV8y1q7mssw,5294
18
18
  socketdev/export/__init__.py,sha256=5DqVqHnaK5Aq-ueSTIAplOZJpF21W_pXysIzmMNLGPg,3667
19
19
  socketdev/fixes/__init__.py,sha256=ouRSQ5FcqQcjAmrU8aAgd0ZJeo431wBOEVKLR36etik,856
20
- socketdev/fullscans/__init__.py,sha256=yN_JQatRxVdyiMWJPDRe4G0fUjZWspoSehaHnB9fNTU,37374
20
+ socketdev/fullscans/__init__.py,sha256=bwpBJlaqmCFCR97y19dFYncpaXvE9lOFdkh1GzLofhk,37714
21
21
  socketdev/historical/__init__.py,sha256=DXFmRrHLWHKbZrB8eermM4YG6j4C1S4Lz6-V63_p2gs,3472
22
22
  socketdev/labels/__init__.py,sha256=Ep19ZraKqi_a-3-eAOWGhPNQsgwGRY9N28Oyxlxrz-g,5128
23
23
  socketdev/licensemetadata/__init__.py,sha256=pDcvpkc08QtMqhsnKP1Cfjvs3m-MRPYUK-uLh8aRkrU,815
24
24
  socketdev/npm/__init__.py,sha256=FvU8z6dY3EsBNLBsKwQKT5soNb6ous1o63aphmbBHh4,906
25
25
  socketdev/openapi/__init__.py,sha256=7Avxgz8RYqC5TCSQCKvmnvzsa2lgV_1y--8eMsy9xYc,500
26
26
  socketdev/org/__init__.py,sha256=2e9fe9jF8V_zb2V-qtmkQZUzJv6qbfpbb1p4Hdgsx9A,903
27
- socketdev/purl/__init__.py,sha256=_ybmj-taH2eArwMPwYX-dO3UA4xoK-TMSgEEvI9Adzg,1345
27
+ socketdev/purl/__init__.py,sha256=TzZz0MlCVaWqX2KYHghsuuRGtSZ2WLjrCYcGpPlNsCQ,1786
28
28
  socketdev/quota/__init__.py,sha256=IblVMP3M7HwXtHs2wnr72GlcNIQtykOKsZKLSehEC8c,487
29
29
  socketdev/report/__init__.py,sha256=L1EuvUnatxWAwQdLiTQwdRNIVglWYoyWqSISuZB0RTE,3454
30
30
  socketdev/repos/__init__.py,sha256=2_BVRYYpA-wF1W9KvhbaBrfe3g2VHLkWLMizWOiyX3A,5641
@@ -39,7 +39,7 @@ socketdev/triage/__init__.py,sha256=-h599vThVetfRSOAs1e4IUoMjcXS8xOsUfub41XPiX4,
39
39
  socketdev/uploadmanifests/__init__.py,sha256=-sFHbOW-aw7U0wRfEJT_Edrzx8aCbzD9cTGmVTNJKpw,6043
40
40
  socketdev/utils/__init__.py,sha256=E11UJTsWsN-ZurOwtKvPGOTc9UMP3ND79nPbmNRRQ6E,17666
41
41
  socketdev/webhooks/__init__.py,sha256=fme6K7ma_Gvk_TFOLz9jVcR5QJbDpMHXqRaU3x_RShY,3507
42
- socketdev-3.0.32.dist-info/METADATA,sha256=BWP5SkmGN87yCs2BB3ajSI3aaOsrXelf53LsTZOlWtI,45141
43
- socketdev-3.0.32.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
44
- socketdev-3.0.32.dist-info/licenses/LICENSE,sha256=mC0II_UuE-_gCG9XqOLNyrV3crnROzMpdAetGnMrhpw,1068
45
- socketdev-3.0.32.dist-info/RECORD,,
42
+ socketdev-3.1.0.dist-info/METADATA,sha256=CjzJav-6BwgI0URd2tgUdqJPG6JWfN8JNG_X-VMjl8M,45557
43
+ socketdev-3.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
44
+ socketdev-3.1.0.dist-info/licenses/LICENSE,sha256=mC0II_UuE-_gCG9XqOLNyrV3crnROzMpdAetGnMrhpw,1068
45
+ socketdev-3.1.0.dist-info/RECORD,,