Skip to content

Commit 9409cb7

Browse files
Update Python SDK (#154)
[bot](2026-03-30 15:29:35) Sync SDK with OpenAPI spec Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 7e405a7 commit 9409cb7

30 files changed

Lines changed: 5661 additions & 4438 deletions

README.md

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ pip install vulncheck-sdk
4646
## Quickstart
4747

4848
```python
49-
import json
5049
import urllib.request
5150
import vulncheck_sdk
5251
import os
@@ -57,7 +56,6 @@ TOKEN = os.environ["VULNCHECK_API_TOKEN"] # Remember to store your token secure
5756
# Now let's create a configuration object
5857
configuration = vulncheck_sdk.Configuration()
5958
configuration.api_key["Bearer"] = TOKEN
60-
configuration.ignore_operation_servers = True
6159

6260
# Pass that config object to our API client and now...
6361
with vulncheck_sdk.ApiClient(configuration) as api_client:
@@ -79,13 +77,10 @@ with vulncheck_sdk.ApiClient(configuration) as api_client:
7977
print(cve)
8078

8179
# Download a Backup
82-
backup_client = vulncheck_sdk.BackupApi(api_client)
8380
index = "initial-access"
84-
raw = backup_client.backup_index_get_without_preload_content(index)
85-
response_data = json.loads(raw.read())
86-
download_url = response_data["data"][0]["url"]
81+
api_response = endpoints_client.backup_index_get(index)
8782
file_path = f"{index}.zip"
88-
with urllib.request.urlopen(download_url) as response:
83+
with urllib.request.urlopen(api_response.data[0].url) as response:
8984
with open(file_path, "wb") as file:
9085
file.write(response.read())
9186

@@ -103,7 +98,6 @@ with vulncheck_sdk.ApiClient(configuration) as api_client:
10398

10499
```python
105100
import asyncio
106-
import json
107101
import os
108102
import aiohttp
109103
import vulncheck_sdk.aio as vcaio
@@ -113,15 +107,13 @@ TOKEN = os.environ.get("VULNCHECK_API_TOKEN")
113107

114108
configuration = vcaio.Configuration()
115109
configuration.api_key["Bearer"] = TOKEN
116-
configuration.ignore_operation_servers = True
117110

118111

119112
async def run_vulnerability_checks():
120113
# Use 'async with' to manage the ApiClient connection pool
121114
async with vcaio.ApiClient(configuration) as api_client:
122115
endpoints_client = vcaio.EndpointsApi(api_client)
123116
indices_client = vcaio.IndicesApi(api_client)
124-
backup_client = vcaio.BackupApi(api_client)
125117

126118
# --- PURL Search ---
127119
# 'await' the coroutine to get results
@@ -146,12 +138,11 @@ async def run_vulnerability_checks():
146138

147139
# --- Download Backup (Async) ---
148140
index_name = "initial-access"
149-
# 'await' the coroutine to get raw response bytes
150-
raw = await backup_client.backup_index_get_without_preload_content(index_name)
151-
response_data = json.loads(await raw.read())
141+
# 'await' the coroutine to get results
142+
backup_response = await endpoints_client.backup_index_get(index_name)
152143

153-
if response_data.get("data"):
154-
download_url = response_data["data"][0]["url"]
144+
if backup_response.data:
145+
download_url = backup_response.data[0].url
155146
file_path = f"{index_name}.zip"
156147

157148
print(f"Downloading backup from {download_url}...")
@@ -323,7 +314,6 @@ if __name__ == "__main__":
323314
Download the backup for an index
324315

325316
```python
326-
import json
327317
import urllib.request
328318
import vulncheck_sdk
329319
import os
@@ -332,19 +322,16 @@ TOKEN = os.environ["VULNCHECK_API_TOKEN"]
332322

333323
configuration = vulncheck_sdk.Configuration()
334324
configuration.api_key["Bearer"] = TOKEN
335-
configuration.ignore_operation_servers = True
336325

337326
with vulncheck_sdk.ApiClient(configuration) as api_client:
338-
backup_client = vulncheck_sdk.BackupApi(api_client)
327+
endpoints_client = vulncheck_sdk.EndpointsApi(api_client)
339328

340329
index = "initial-access"
341330

342-
raw = backup_client.backup_index_get_without_preload_content(index)
343-
response_data = json.loads(raw.read())
344-
download_url = response_data["data"][0]["url"]
331+
api_response = endpoints_client.backup_index_get(index)
345332

346333
file_path = f"{index}.zip"
347-
with urllib.request.urlopen(download_url) as response:
334+
with urllib.request.urlopen(api_response.data[0].url) as response:
348335
with open(file_path, "wb") as file:
349336
file.write(response.read())
350337
```
@@ -354,7 +341,6 @@ with vulncheck_sdk.ApiClient(configuration) as api_client:
354341

355342
```python
356343
import asyncio
357-
import json
358344
import os
359345
import urllib.request
360346
import vulncheck_sdk.aio as vcaio
@@ -364,7 +350,6 @@ TOKEN = os.environ.get("VULNCHECK_API_TOKEN")
364350

365351
configuration = vcaio.Configuration()
366352
configuration.api_key["Bearer"] = TOKEN
367-
configuration.ignore_operation_servers = True
368353

369354

370355
def download_sync(url, file_path):
@@ -380,19 +365,23 @@ def download_sync(url, file_path):
380365
async def main():
381366
# Use 'async with' to manage the connection life-cycle
382367
async with vcaio.ApiClient(configuration) as api_client:
383-
backup_client = vcaio.BackupApi(api_client)
368+
endpoints_client = vcaio.EndpointsApi(api_client)
384369
index = "initial-access"
385370

386-
# 'await' the coroutine to get the raw response bytes
387-
raw = await backup_client.backup_index_get_without_preload_content(index)
388-
response_data = json.loads(await raw.read())
389-
download_url = response_data["data"][0]["url"]
371+
# 'await' the coroutine to get the actual response data
372+
api_response = await endpoints_client.backup_index_get(index)
373+
374+
if not api_response.data:
375+
print("No backup URL found.")
376+
return
390377

378+
download_url = api_response.data[0].url
391379
file_path = f"{index}.zip"
392380

393381
print(f"Downloading {index} via urllib (offloaded to thread)...")
394382

395383
# Use asyncio.to_thread to run the blocking call safely
384+
# 'await' the coroutine to get the actual response data
396385
await asyncio.to_thread(download_sync, download_url, file_path)
397386

398387
print(f"Successfully saved to {file_path}")

docs/AdvisoryApi.md

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# vulncheck_sdk.AdvisoryApi
22

3-
All URIs are relative to *https://api.vulncheck.com/v3*
3+
All URIs are relative to *https://api.vulncheck.com*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7-
[**advisory_get**](AdvisoryApi.md#advisory_get) | **GET** /advisory | Query advisories
8-
[**advisory_list_get**](AdvisoryApi.md#advisory_list_get) | **GET** /advisory/list | List advisory feeds
7+
[**v4_list_advisory_feeds**](AdvisoryApi.md#v4_list_advisory_feeds) | **GET** /v4/advisory/list | List advisory feeds
8+
[**v4_query_advisories**](AdvisoryApi.md#v4_query_advisories) | **GET** /v4/advisory | Query advisories
99

1010

11-
# **advisory_get**
12-
> SearchV4AdvisoryReturnValue advisory_get(name=name, cve_id=cve_id, vendor=vendor, product=product, platform=platform, version=version, cpe=cpe, package_name=package_name, purl=purl, reference_url=reference_url, reference_tag=reference_tag, description_lang=description_lang, updated_after=updated_after, updated_before=updated_before, page=page, limit=limit, start_cursor=start_cursor, cursor=cursor)
11+
# **v4_list_advisory_feeds**
12+
> SearchV4ListFeedReturnValue v4_list_advisory_feeds()
1313
14-
Query advisories
14+
List advisory feeds
1515

16-
Query the VulnCheck v4 advisory index
16+
Return a list of available advisory feed names
1717

1818
### Example
1919

2020
* Api Key Authentication (Bearer):
2121

2222
```python
2323
import vulncheck_sdk
24-
from vulncheck_sdk.models.search_v4_advisory_return_value import SearchV4AdvisoryReturnValue
24+
from vulncheck_sdk.models.search_v4_list_feed_return_value import SearchV4ListFeedReturnValue
2525
from vulncheck_sdk.rest import ApiException
2626
from pprint import pprint
2727

28-
# Defining the host is optional and defaults to https://api.vulncheck.com/v3
28+
# Defining the host is optional and defaults to https://api.vulncheck.com
2929
# See configuration.py for a list of all supported configuration parameters.
3030
configuration = vulncheck_sdk.Configuration(
31-
host = "https://api.vulncheck.com/v3"
31+
host = "https://api.vulncheck.com"
3232
)
3333

3434
# The client must configure the authentication and authorization parameters
@@ -46,63 +46,25 @@ configuration.api_key['Bearer'] = os.environ["API_KEY"]
4646
with vulncheck_sdk.ApiClient(configuration) as api_client:
4747
# Create an instance of the API class
4848
api_instance = vulncheck_sdk.AdvisoryApi(api_client)
49-
name = 'name_example' # str | Filter by advisory feed name (e.g. 'vulncheck') (optional)
50-
cve_id = 'cve_id_example' # str | Filter by CVE ID (e.g. 'CVE-2024-1234') (optional)
51-
vendor = 'vendor_example' # str | Filter by vendor name (optional)
52-
product = 'product_example' # str | Filter by product name (optional)
53-
platform = 'platform_example' # str | Filter by OS/platform (optional)
54-
version = 'version_example' # str | Filter by product version (semver-aware) (optional)
55-
cpe = 'cpe_example' # str | Filter by CPE (e.g. 'cpe:2.3:a:vendor:product:*') (optional)
56-
package_name = 'package_name_example' # str | Filter by package name (optional)
57-
purl = 'purl_example' # str | Filter by package URL (PURL) (optional)
58-
reference_url = 'reference_url_example' # str | Filter by reference URL (optional)
59-
reference_tag = 'reference_tag_example' # str | Filter by reference tag (e.g. 'patch', 'advisory') (optional)
60-
description_lang = 'description_lang_example' # str | Filter by description language (e.g. 'en') (optional)
61-
updated_after = 'updated_after_example' # str | Return advisories updated after this date (RFC3339 or date-math e.g. 'now-30d') (optional)
62-
updated_before = 'updated_before_example' # str | Return advisories updated before this date (RFC3339 or date-math) (optional)
63-
page = 56 # int | Page number (default: 1) (optional)
64-
limit = 56 # int | Results per page, max 100 (default: 10) (optional)
65-
start_cursor = 'start_cursor_example' # str | Presence activates cursor mode from the first page (value is ignored; cannot be combined with page) (optional)
66-
cursor = 'cursor_example' # str | Cursor from previous response _meta.next_cursor to fetch the next page (optional)
6749

6850
try:
69-
# Query advisories
70-
api_response = api_instance.advisory_get(name=name, cve_id=cve_id, vendor=vendor, product=product, platform=platform, version=version, cpe=cpe, package_name=package_name, purl=purl, reference_url=reference_url, reference_tag=reference_tag, description_lang=description_lang, updated_after=updated_after, updated_before=updated_before, page=page, limit=limit, start_cursor=start_cursor, cursor=cursor)
71-
print("The response of AdvisoryApi->advisory_get:\n")
51+
# List advisory feeds
52+
api_response = api_instance.v4_list_advisory_feeds()
53+
print("The response of AdvisoryApi->v4_list_advisory_feeds:\n")
7254
pprint(api_response)
7355
except Exception as e:
74-
print("Exception when calling AdvisoryApi->advisory_get: %s\n" % e)
56+
print("Exception when calling AdvisoryApi->v4_list_advisory_feeds: %s\n" % e)
7557
```
7658

7759

7860

7961
### Parameters
8062

81-
82-
Name | Type | Description | Notes
83-
------------- | ------------- | ------------- | -------------
84-
**name** | **str**| Filter by advisory feed name (e.g. &#39;vulncheck&#39;) | [optional]
85-
**cve_id** | **str**| Filter by CVE ID (e.g. &#39;CVE-2024-1234&#39;) | [optional]
86-
**vendor** | **str**| Filter by vendor name | [optional]
87-
**product** | **str**| Filter by product name | [optional]
88-
**platform** | **str**| Filter by OS/platform | [optional]
89-
**version** | **str**| Filter by product version (semver-aware) | [optional]
90-
**cpe** | **str**| Filter by CPE (e.g. &#39;cpe:2.3:a:vendor:product:*&#39;) | [optional]
91-
**package_name** | **str**| Filter by package name | [optional]
92-
**purl** | **str**| Filter by package URL (PURL) | [optional]
93-
**reference_url** | **str**| Filter by reference URL | [optional]
94-
**reference_tag** | **str**| Filter by reference tag (e.g. &#39;patch&#39;, &#39;advisory&#39;) | [optional]
95-
**description_lang** | **str**| Filter by description language (e.g. &#39;en&#39;) | [optional]
96-
**updated_after** | **str**| Return advisories updated after this date (RFC3339 or date-math e.g. &#39;now-30d&#39;) | [optional]
97-
**updated_before** | **str**| Return advisories updated before this date (RFC3339 or date-math) | [optional]
98-
**page** | **int**| Page number (default: 1) | [optional]
99-
**limit** | **int**| Results per page, max 100 (default: 10) | [optional]
100-
**start_cursor** | **str**| Presence activates cursor mode from the first page (value is ignored; cannot be combined with page) | [optional]
101-
**cursor** | **str**| Cursor from previous response _meta.next_cursor to fetch the next page | [optional]
63+
This endpoint does not need any parameter.
10264

10365
### Return type
10466

105-
[**SearchV4AdvisoryReturnValue**](SearchV4AdvisoryReturnValue.md)
67+
[**SearchV4ListFeedReturnValue**](SearchV4ListFeedReturnValue.md)
10668

10769
### Authorization
10870

@@ -125,27 +87,27 @@ Name | Type | Description | Notes
12587

12688
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
12789

128-
# **advisory_list_get**
129-
> SearchV4ListFeedReturnValue advisory_list_get()
90+
# **v4_query_advisories**
91+
> SearchV4AdvisoryReturnValue v4_query_advisories(name=name, cve_id=cve_id, vendor=vendor, product=product, platform=platform, version=version, cpe=cpe, package_name=package_name, purl=purl, reference_url=reference_url, reference_tag=reference_tag, description_lang=description_lang, updated_after=updated_after, updated_before=updated_before, page=page, limit=limit, start_cursor=start_cursor, cursor=cursor)
13092
131-
List advisory feeds
93+
Query advisories
13294

133-
Return a list of available advisory feed names
95+
Query the VulnCheck v4 advisory index
13496

13597
### Example
13698

13799
* Api Key Authentication (Bearer):
138100

139101
```python
140102
import vulncheck_sdk
141-
from vulncheck_sdk.models.search_v4_list_feed_return_value import SearchV4ListFeedReturnValue
103+
from vulncheck_sdk.models.search_v4_advisory_return_value import SearchV4AdvisoryReturnValue
142104
from vulncheck_sdk.rest import ApiException
143105
from pprint import pprint
144106

145-
# Defining the host is optional and defaults to https://api.vulncheck.com/v3
107+
# Defining the host is optional and defaults to https://api.vulncheck.com
146108
# See configuration.py for a list of all supported configuration parameters.
147109
configuration = vulncheck_sdk.Configuration(
148-
host = "https://api.vulncheck.com/v3"
110+
host = "https://api.vulncheck.com"
149111
)
150112

151113
# The client must configure the authentication and authorization parameters
@@ -163,25 +125,63 @@ configuration.api_key['Bearer'] = os.environ["API_KEY"]
163125
with vulncheck_sdk.ApiClient(configuration) as api_client:
164126
# Create an instance of the API class
165127
api_instance = vulncheck_sdk.AdvisoryApi(api_client)
128+
name = 'name_example' # str | Filter by advisory feed name (e.g. 'vulncheck') (optional)
129+
cve_id = 'cve_id_example' # str | Filter by CVE ID (e.g. 'CVE-2024-1234') (optional)
130+
vendor = 'vendor_example' # str | Filter by vendor name (optional)
131+
product = 'product_example' # str | Filter by product name (optional)
132+
platform = 'platform_example' # str | Filter by OS/platform (optional)
133+
version = 'version_example' # str | Filter by product version (semver-aware) (optional)
134+
cpe = 'cpe_example' # str | Filter by CPE (e.g. 'cpe:2.3:a:vendor:product:*') (optional)
135+
package_name = 'package_name_example' # str | Filter by package name (optional)
136+
purl = 'purl_example' # str | Filter by package URL (PURL) (optional)
137+
reference_url = 'reference_url_example' # str | Filter by reference URL (optional)
138+
reference_tag = 'reference_tag_example' # str | Filter by reference tag (e.g. 'patch', 'advisory') (optional)
139+
description_lang = 'description_lang_example' # str | Filter by description language (e.g. 'en') (optional)
140+
updated_after = 'updated_after_example' # str | Return advisories updated after this date (RFC3339 or date-math e.g. 'now-30d') (optional)
141+
updated_before = 'updated_before_example' # str | Return advisories updated before this date (RFC3339 or date-math) (optional)
142+
page = 56 # int | Page number (default: 1) (optional)
143+
limit = 56 # int | Results per page, max 100 (default: 10) (optional)
144+
start_cursor = 'start_cursor_example' # str | Presence activates cursor mode from the first page (value is ignored; cannot be combined with page) (optional)
145+
cursor = 'cursor_example' # str | Cursor from previous response _meta.next_cursor to fetch the next page (optional)
166146

167147
try:
168-
# List advisory feeds
169-
api_response = api_instance.advisory_list_get()
170-
print("The response of AdvisoryApi->advisory_list_get:\n")
148+
# Query advisories
149+
api_response = api_instance.v4_query_advisories(name=name, cve_id=cve_id, vendor=vendor, product=product, platform=platform, version=version, cpe=cpe, package_name=package_name, purl=purl, reference_url=reference_url, reference_tag=reference_tag, description_lang=description_lang, updated_after=updated_after, updated_before=updated_before, page=page, limit=limit, start_cursor=start_cursor, cursor=cursor)
150+
print("The response of AdvisoryApi->v4_query_advisories:\n")
171151
pprint(api_response)
172152
except Exception as e:
173-
print("Exception when calling AdvisoryApi->advisory_list_get: %s\n" % e)
153+
print("Exception when calling AdvisoryApi->v4_query_advisories: %s\n" % e)
174154
```
175155

176156

177157

178158
### Parameters
179159

180-
This endpoint does not need any parameter.
160+
161+
Name | Type | Description | Notes
162+
------------- | ------------- | ------------- | -------------
163+
**name** | **str**| Filter by advisory feed name (e.g. &#39;vulncheck&#39;) | [optional]
164+
**cve_id** | **str**| Filter by CVE ID (e.g. &#39;CVE-2024-1234&#39;) | [optional]
165+
**vendor** | **str**| Filter by vendor name | [optional]
166+
**product** | **str**| Filter by product name | [optional]
167+
**platform** | **str**| Filter by OS/platform | [optional]
168+
**version** | **str**| Filter by product version (semver-aware) | [optional]
169+
**cpe** | **str**| Filter by CPE (e.g. &#39;cpe:2.3:a:vendor:product:*&#39;) | [optional]
170+
**package_name** | **str**| Filter by package name | [optional]
171+
**purl** | **str**| Filter by package URL (PURL) | [optional]
172+
**reference_url** | **str**| Filter by reference URL | [optional]
173+
**reference_tag** | **str**| Filter by reference tag (e.g. &#39;patch&#39;, &#39;advisory&#39;) | [optional]
174+
**description_lang** | **str**| Filter by description language (e.g. &#39;en&#39;) | [optional]
175+
**updated_after** | **str**| Return advisories updated after this date (RFC3339 or date-math e.g. &#39;now-30d&#39;) | [optional]
176+
**updated_before** | **str**| Return advisories updated before this date (RFC3339 or date-math) | [optional]
177+
**page** | **int**| Page number (default: 1) | [optional]
178+
**limit** | **int**| Results per page, max 100 (default: 10) | [optional]
179+
**start_cursor** | **str**| Presence activates cursor mode from the first page (value is ignored; cannot be combined with page) | [optional]
180+
**cursor** | **str**| Cursor from previous response _meta.next_cursor to fetch the next page | [optional]
181181

182182
### Return type
183183

184-
[**SearchV4ListFeedReturnValue**](SearchV4ListFeedReturnValue.md)
184+
[**SearchV4AdvisoryReturnValue**](SearchV4AdvisoryReturnValue.md)
185185

186186
### Authorization
187187

0 commit comments

Comments
 (0)