Skip to content

Commit d05ee02

Browse files
add multiple tlp support (#5)
* add multiple tlp support * version 0.1.4 release * fix failing tests
1 parent c447efc commit d05ee02

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "python-catalyst"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "Python client for the PRODAFT CATALYST API"
55
readme = "README.md"
66
license = { file = "LICENSE" }

python_catalyst/client.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,13 @@ def get_member_contents(
148148

149149
if tlp:
150150
if len(tlp) > 0:
151-
first_tlp = tlp[0]
152-
params["tlp"] = (
153-
first_tlp.value if isinstance(first_tlp, TLPLevel) else first_tlp
154-
)
155-
if len(tlp) > 1:
156-
self.logger.debug(
157-
f"Multiple TLP values provided but API only supports one. Using: {params['tlp']}"
158-
)
151+
tlps = []
152+
for t in tlp:
153+
if isinstance(t, TLPLevel):
154+
tlps.append(t.value)
155+
else:
156+
tlps.append(t)
157+
params["tlp"] = tlps
159158

160159
if published_on_after:
161160
params["published_on_after"] = published_on_after.isoformat()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="python-catalyst",
8-
version="0.1.3",
8+
version="0.1.4",
99
description="Python client for the PRODAFT CATALYST API",
1010
long_description=long_description,
1111
long_description_content_type="text/markdown",

tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_get_member_contents(self, mock_handle_request):
8484
self.client.content_endpoint,
8585
params={
8686
"category": "RESEARCH",
87-
"tlp": "TLP:AMBER",
87+
"tlp": ["TLP:AMBER"],
8888
"published_on_after": test_datetime.isoformat(),
8989
"published_on_before": test_datetime.isoformat(),
9090
"updated_on_after": test_datetime.isoformat(),

0 commit comments

Comments
 (0)