Skip to content

Commit c4e9d27

Browse files
nitescucgithub-actions[bot]
authored andcommitted
Update python SDK 1.101.0
1 parent 562a7bf commit c4e9d27

File tree

8 files changed

+114
-120
lines changed

8 files changed

+114
-120
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

crowdsec_tracker_api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: <stdin>
3-
# timestamp: 2026-01-06T15:34:27+00:00
3+
# timestamp: 2026-01-19T16:09:33+00:00
44

55
from __future__ import annotations
66

Binary file not shown.
Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,89 @@
11
import json
22
from types import NoneType
3-
from typing import Annotated, Optional, Union
3+
from typing import Optional, Union, Annotated
44

5-
from httpx import Auth
5+
from ..models import *
6+
from ..base_model import Page, Service
67
from pydantic import BaseModel, Field
78
from pydantic.fields import FieldInfo
8-
9-
from ..base_model import Page, Service
9+
from httpx import Auth
1010
from ..http_client import HttpClient
11-
from ..models import *
12-
1311

1412
class Cves(Service):
15-
def __init__(
16-
self, auth: Auth, base_url: str = "https://admin.api.crowdsec.net/v1"
17-
) -> None:
18-
super().__init__(
19-
base_url=base_url, auth=auth, user_agent="crowdsec_tracker_api/1.95.2"
20-
)
21-
13+
def __init__(self, auth: Auth, base_url: str = "https://admin.api.crowdsec.net/v1") -> None:
14+
super().__init__(base_url=base_url, auth=auth, user_agent="crowdsec_tracker_api/1.101.0")
15+
2216
def get_cves(
2317
self,
2418
query: Optional[str] = None,
2519
sort_by: Optional[GetCVEsSortBy] = GetCVEsSortBy("rule_release_date"),
2620
sort_order: Optional[GetCVEsSortOrder] = GetCVEsSortOrder("desc"),
2721
page: int = 1,
2822
size: int = 50,
29-
) -> GetCVEsResponsePage:
23+
)-> GetCVEsResponsePage:
3024
endpoint_url = "/cves"
3125
loc = locals()
3226
headers = {}
3327
params = json.loads(
34-
CvesGetCvesQueryParameters(**loc).model_dump_json(exclude_none=True)
28+
CvesGetCvesQueryParameters(**loc).model_dump_json(
29+
exclude_none=True
30+
)
3531
)
3632
path_params = {}
37-
33+
3834
response = self.http_client.get(
3935
url=endpoint_url, path_params=path_params, params=params, headers=headers
4036
)
41-
37+
4238
return GetCVEsResponsePage(_client=self, **response.json())
43-
39+
4440
def get_cve(
4541
self,
4642
cve_id: str,
47-
) -> GetCVEResponse:
43+
)-> GetCVEResponse:
4844
endpoint_url = "/cves/{cve_id}"
4945
loc = locals()
5046
headers = {}
5147
params = {}
5248
path_params = json.loads(
53-
CvesGetCvePathParameters(**loc).model_dump_json(exclude_none=True)
49+
CvesGetCvePathParameters(**loc).model_dump_json(
50+
exclude_none=True
51+
)
5452
)
55-
53+
5654
response = self.http_client.get(
5755
url=endpoint_url, path_params=path_params, params=params, headers=headers
5856
)
59-
57+
6058
return GetCVEResponse(**response.json())
61-
59+
6260
def download_cve_ips(
6361
self,
6462
cve_id: str,
65-
) -> str:
63+
)-> str:
6664
endpoint_url = "/cves/{cve_id}/ips-download"
6765
loc = locals()
6866
headers = {}
6967
params = {}
7068
path_params = json.loads(
71-
CvesDownloadCveIpsPathParameters(**loc).model_dump_json(exclude_none=True)
69+
CvesDownloadCveIpsPathParameters(**loc).model_dump_json(
70+
exclude_none=True
71+
)
7272
)
73-
73+
7474
response = self.http_client.get(
7575
url=endpoint_url, path_params=path_params, params=params, headers=headers
7676
)
77-
77+
7878
return response.text
79-
79+
8080
def get_cve_ips_details(
8181
self,
8282
cve_id: str,
8383
since: Optional[str] = "14d",
8484
page: int = 1,
8585
size: int = 50,
86-
) -> GetCVEIPsResponsePage:
86+
)-> GetCVEIPsResponsePage:
8787
endpoint_url = "/cves/{cve_id}/ips-details"
8888
loc = locals()
8989
headers = {}
@@ -93,21 +93,23 @@ def get_cve_ips_details(
9393
)
9494
)
9595
path_params = json.loads(
96-
CvesGetCveIpsDetailsPathParameters(**loc).model_dump_json(exclude_none=True)
96+
CvesGetCveIpsDetailsPathParameters(**loc).model_dump_json(
97+
exclude_none=True
98+
)
9799
)
98-
100+
99101
response = self.http_client.get(
100102
url=endpoint_url, path_params=path_params, params=params, headers=headers
101103
)
102-
104+
103105
return GetCVEIPsResponsePage(_client=self, **response.json())
104-
106+
105107
def get_cve_subscribed_integrations(
106108
self,
107109
cve_id: str,
108110
page: int = 1,
109111
size: int = 50,
110-
) -> GetCVESubscribedIntegrationsResponsePage:
112+
)-> GetCVESubscribedIntegrationsResponsePage:
111113
endpoint_url = "/cves/{cve_id}/integrations"
112114
loc = locals()
113115
headers = {}
@@ -121,13 +123,13 @@ def get_cve_subscribed_integrations(
121123
exclude_none=True
122124
)
123125
)
124-
126+
125127
response = self.http_client.get(
126128
url=endpoint_url, path_params=path_params, params=params, headers=headers
127129
)
128-
130+
129131
return GetCVESubscribedIntegrationsResponsePage(_client=self, **response.json())
130-
132+
131133
def subscribe_integration_to_cve(
132134
self,
133135
request: SubscribeCVEIntegrationRequest,
@@ -142,22 +144,18 @@ def subscribe_integration_to_cve(
142144
exclude_none=True
143145
)
144146
)
145-
146-
payload = (
147-
json.loads(request.model_dump_json(exclude_none=True))
148-
if "request" in loc
149-
else None
150-
)
147+
148+
payload = json.loads(
149+
request.model_dump_json(
150+
exclude_none=True
151+
)
152+
) if "request" in loc else None
151153
response = self.http_client.post(
152-
url=endpoint_url,
153-
path_params=path_params,
154-
params=params,
155-
headers=headers,
156-
json=payload,
154+
url=endpoint_url, path_params=path_params, params=params, headers=headers, json=payload
157155
)
158-
156+
159157
return None
160-
158+
161159
def unsubscribe_integration_from_cve(
162160
self,
163161
cve_id: str,
@@ -172,30 +170,35 @@ def unsubscribe_integration_from_cve(
172170
exclude_none=True
173171
)
174172
)
175-
173+
176174
response = self.http_client.delete(
177175
url=endpoint_url, path_params=path_params, params=params, headers=headers
178176
)
179-
177+
180178
return None
181-
179+
182180
def get_cve_timeline(
183181
self,
184182
cve_id: str,
185183
since_days: SinceOptions,
186-
) -> list[TimelineItem]:
184+
)-> list[TimelineItem]:
187185
endpoint_url = "/cves/{cve_id}/timeline"
188186
loc = locals()
189187
headers = {}
190188
params = json.loads(
191-
CvesGetCveTimelineQueryParameters(**loc).model_dump_json(exclude_none=True)
189+
CvesGetCveTimelineQueryParameters(**loc).model_dump_json(
190+
exclude_none=True
191+
)
192192
)
193193
path_params = json.loads(
194-
CvesGetCveTimelinePathParameters(**loc).model_dump_json(exclude_none=True)
194+
CvesGetCveTimelinePathParameters(**loc).model_dump_json(
195+
exclude_none=True
196+
)
195197
)
196-
198+
197199
response = self.http_client.get(
198200
url=endpoint_url, path_params=path_params, params=params, headers=headers
199201
)
200-
202+
201203
return [TimelineItem(**item) for item in response.json()]
204+

0 commit comments

Comments
 (0)