polyswarm-api 4.1.0__tar.gz → 4.2.0__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.
- {polyswarm_api-4.1.0/src/polyswarm_api.egg-info → polyswarm_api-4.2.0}/PKG-INFO +1 -1
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/pyproject.toml +2 -2
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/__init__.py +1 -1
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/aio/api.py +9 -5
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/aio/session.py +13 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/api.py +8 -4
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/session.py +14 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0/src/polyswarm_api.egg-info}/PKG-INFO +1 -1
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/LICENSE +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/README.md +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/setup.cfg +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/aio/__init__.py +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/core.py +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/exceptions.py +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/resources.py +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api/settings.py +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api.egg-info/SOURCES.txt +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api.egg-info/dependency_links.txt +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api.egg-info/requires.txt +0 -0
- {polyswarm_api-4.1.0 → polyswarm_api-4.2.0}/src/polyswarm_api.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "polyswarm_api"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.2.0"
|
|
8
8
|
description = "Client library to simplify interacting with the PolySwarm consumer API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10,<4"
|
|
@@ -55,7 +55,7 @@ package-dir = { "" = "src" }
|
|
|
55
55
|
where = ["src"]
|
|
56
56
|
|
|
57
57
|
[tool.bumpversion]
|
|
58
|
-
current_version = "4.
|
|
58
|
+
current_version = "4.2.0"
|
|
59
59
|
commit = true
|
|
60
60
|
tag = false
|
|
61
61
|
sign_tags = true
|
|
@@ -1025,7 +1025,8 @@ class PolySwarmAsyncAPI:
|
|
|
1025
1025
|
report_task = await self._single(resources.ReportLLMPostProcessing.create(self,
|
|
1026
1026
|
instance_id=instance_id,
|
|
1027
1027
|
cape_sandbox_task_id=cape_sandbox_task_id,
|
|
1028
|
-
triage_sandbox_task_id=triage_sandbox_task_id
|
|
1028
|
+
triage_sandbox_task_id=triage_sandbox_task_id,
|
|
1029
|
+
community=self.community))
|
|
1029
1030
|
return report_task
|
|
1030
1031
|
|
|
1031
1032
|
async def llm_report_get(self, report_task_id):
|
|
@@ -1651,8 +1652,11 @@ class PolySwarmAsyncAPI:
|
|
|
1651
1652
|
self, hash_.hash, hash_.hash_type, require_scan=require_scan,
|
|
1652
1653
|
),
|
|
1653
1654
|
)
|
|
1654
|
-
# exists_hash is a HEAD; ``result`` is the status code.
|
|
1655
|
-
#
|
|
1656
|
-
#
|
|
1657
|
-
|
|
1655
|
+
# exists_hash is a HEAD; ``result`` is the status code. The endpoint returns
|
|
1656
|
+
# 200 when the artifact is present and 204 when it is absent ("the request
|
|
1657
|
+
# worked, but there was no matching artifact, so nothing was returned"). Only
|
|
1658
|
+
# a 200 means the artifact exists — 204 (and 404) both mean "absent" → False.
|
|
1659
|
+
# NB: this is deliberately ``== 200``, not a ``// 100 == 2`` 2xx check, because
|
|
1660
|
+
# 204 is a successful 2xx that means the opposite of "exists".
|
|
1661
|
+
return int(result) == 200
|
|
1658
1662
|
|
|
@@ -148,6 +148,19 @@ class AsyncPolyswarmSession:
|
|
|
148
148
|
await response.aread()
|
|
149
149
|
_raise_for_status(response, request)
|
|
150
150
|
|
|
151
|
+
if response.status_code == 204:
|
|
152
|
+
# A 204 is the "no data / absent" signal on a download: the request
|
|
153
|
+
# succeeded but there is nothing to write ("the request worked, but
|
|
154
|
+
# there was no matching artifact, so nothing was returned"). The
|
|
155
|
+
# shared ``parse_response`` maps a parser-backed 204 to
|
|
156
|
+
# ``NoResultsException``; the streaming path bypasses ``parse_response``,
|
|
157
|
+
# so mirror that rule explicitly here. Without it, an absent artifact
|
|
158
|
+
# would be written out as a successful *empty* file instead of
|
|
159
|
+
# surfacing "no results".
|
|
160
|
+
raise exceptions.NoResultsException(
|
|
161
|
+
request, 'The request returned no results.',
|
|
162
|
+
)
|
|
163
|
+
|
|
151
164
|
pk = request.parser_kwargs or {}
|
|
152
165
|
handle, name, created = request.result_parser.open_destination(
|
|
153
166
|
pk.get('folder'), pk.get('handle'), pk.get('artifact_name'), response,
|
|
@@ -1262,6 +1262,7 @@ class PolyswarmAPI:
|
|
|
1262
1262
|
instance_id=instance_id,
|
|
1263
1263
|
cape_sandbox_task_id=cape_sandbox_task_id,
|
|
1264
1264
|
triage_sandbox_task_id=triage_sandbox_task_id,
|
|
1265
|
+
community=self.community,
|
|
1265
1266
|
)
|
|
1266
1267
|
)
|
|
1267
1268
|
return report_task
|
|
@@ -2001,7 +2002,10 @@ class PolyswarmAPI:
|
|
|
2001
2002
|
require_scan=require_scan,
|
|
2002
2003
|
),
|
|
2003
2004
|
)
|
|
2004
|
-
# exists_hash is a HEAD; ``result`` is the status code.
|
|
2005
|
-
#
|
|
2006
|
-
#
|
|
2007
|
-
|
|
2005
|
+
# exists_hash is a HEAD; ``result`` is the status code. The endpoint returns
|
|
2006
|
+
# 200 when the artifact is present and 204 when it is absent ("the request
|
|
2007
|
+
# worked, but there was no matching artifact, so nothing was returned"). Only
|
|
2008
|
+
# a 200 means the artifact exists — 204 (and 404) both mean "absent" → False.
|
|
2009
|
+
# NB: this is deliberately ``== 200``, not a ``// 100 == 2`` 2xx check, because
|
|
2010
|
+
# 204 is a successful 2xx that means the opposite of "exists".
|
|
2011
|
+
return int(result) == 200
|
|
@@ -151,6 +151,20 @@ class PolyswarmSession:
|
|
|
151
151
|
response.read()
|
|
152
152
|
_raise_for_status(response, request)
|
|
153
153
|
|
|
154
|
+
if response.status_code == 204:
|
|
155
|
+
# A 204 is the "no data / absent" signal on a download: the request
|
|
156
|
+
# succeeded but there is nothing to write ("the request worked, but
|
|
157
|
+
# there was no matching artifact, so nothing was returned"). The
|
|
158
|
+
# shared ``parse_response`` maps a parser-backed 204 to
|
|
159
|
+
# ``NoResultsException``; the streaming path bypasses ``parse_response``,
|
|
160
|
+
# so mirror that rule explicitly here. Without it, an absent artifact
|
|
161
|
+
# would be written out as a successful *empty* file instead of
|
|
162
|
+
# surfacing "no results".
|
|
163
|
+
raise exceptions.NoResultsException(
|
|
164
|
+
request,
|
|
165
|
+
"The request returned no results.",
|
|
166
|
+
)
|
|
167
|
+
|
|
154
168
|
pk = request.parser_kwargs or {}
|
|
155
169
|
handle, name, created = request.result_parser.open_destination(
|
|
156
170
|
pk.get("folder"),
|
|
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
|