Cisco Cyber Vision¶
The base URL for this client must end with /api/3.0.
wingpy.cisco.cybervision.CiscoCyberVision
¶
CiscoCyberVision(
*,
base_url: str | None = None,
token: str | None = None,
verify: SSLContext | bool = True,
timeout: int = 10,
retries: int = 3
)
Bases: RestApiBaseClass
Interact with the Cisco Cyber Vision API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str | None
|
Base URL of the API including Must end with Overrides the environment variable |
None
|
token
|
str | None
|
Token for API authentication sent in the Overrides the environment variable |
None
|
verify
|
bool | SSLContext
|
Boolean values will enable or disable the default SSL verification. Use an ssl.SSLContext to specify custom Certificate Authority. |
True
|
timeout
|
int
|
Number of seconds to wait for HTTP responses before raising httpx.TimeoutException exception. |
10
|
retries
|
int
|
Number of failed HTTP attempts allowed before raising httpx.HTTPStatusError exception. |
3
|
Examples:
from wingpy import CiscoCyberVision
cybervision = CiscoCyberVision(
base_url="https://cybervision.example.com/api/3.0",
token="ics-token",
)
rsp = cybervision.get("/sensors")
print(rsp.status_code)
Source code in src/wingpy/cisco/cybervision.py
get
¶
get(
path: str,
*,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None
) -> ResponseMapping | ResponseSequence
Send an HTTP GET request to the specified path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseMapping | ResponseSequence
|
The |
Source code in src/wingpy/cisco/cybervision.py
get_all
¶
get_all(
path: str,
*,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None,
page_size: int = 1000
) -> list[dict]
Retrieve all paginated results from a Cisco Cyber Vision endpoint.
Pagination starts at page 1 and uses the query parameter size
for page length.
The end of the result set is detected when a page returns fewer items than the configured page size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
page_size
|
int
|
Number of objects to request per page. |
1000
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
A list containing all objects returned by the endpoint. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If page_size is less than 1. |
ValueError
|
If a page response is not a JSON array. |
Source code in src/wingpy/cisco/cybervision.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |
get_page
¶
get_page(
path: str,
*,
page: int,
page_size: int,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None
) -> ResponseMapping | ResponseSequence
Retrieve a specific page of data from a Cisco Cyber Vision endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
page
|
int
|
Page number to retrieve. Page numbering starts at |
required |
page_size
|
int
|
Number of objects to request per page. |
required |
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseMapping | ResponseSequence
|
The |
Raises:
| Type | Description |
|---|---|
ValueError
|
If page is less than 1. |
ValueError
|
If page_size is less than 1. |
Source code in src/wingpy/cisco/cybervision.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |
post
¶
post(
path: str,
*,
data: str | dict | list | None,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None
) -> ResponseMapping | ResponseSequence
Send an HTTP POST request to the specified path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
data
|
str | dict | list | None
|
Request payload as JSON string or Python list/dict object. |
required |
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseMapping | ResponseSequence
|
The |
Source code in src/wingpy/cisco/cybervision.py
put
¶
put(
path: str,
*,
data: str | dict | list | None,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None
) -> ResponseMapping | ResponseSequence
Send an HTTP PUT request to the specified path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
data
|
str | dict | list | None
|
Request payload as JSON string or Python list/dict object. |
required |
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseMapping | ResponseSequence
|
The |
Source code in src/wingpy/cisco/cybervision.py
patch
¶
patch(
path: str,
*,
data: str | dict | list | None,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None
) -> ResponseMapping | ResponseSequence
Send an HTTP PATCH request to the specified path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
data
|
str | dict | list | None
|
Request payload as JSON string or Python list/dict object. |
required |
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseMapping | ResponseSequence
|
The |
Source code in src/wingpy/cisco/cybervision.py
delete
¶
delete(
path: str,
*,
data: str | dict | list | None = None,
params: dict | None = None,
path_params: dict | None = None,
headers: dict | None = None,
timeout: int | None = None
) -> ResponseMapping | ResponseSequence
Send an HTTP DELETE request to the specified path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The API endpoint path to send the request to. |
required |
data
|
str | dict | list | None
|
Request payload as JSON string or Python list/dict object. |
None
|
params
|
dict | None
|
URL query parameters to include in the request. will be added as |
None
|
path_params
|
dict | None
|
Replace placeholders like Will be combined with self.path_params before sending request. |
None
|
headers
|
dict | None
|
HTTP headers to be sent with the request. Will be combined with self.headers before sending request. |
None
|
timeout
|
int | None
|
Override the standard timeout timer self.timeout for a single request. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseMapping | ResponseSequence
|
The |
Source code in src/wingpy/cisco/cybervision.py
authenticate
¶
Executes the API-specific authentication process and records timestamps for session tracking.
Notes
Authentication will automatically be carried out just-in-time.
Only call this method directly if you need to authenticate proactively, outside of normal request flow.
Source code in src/wingpy/base.py
tasks
¶
Manages concurrent requests to the API server.
The number of concurrent requests is limited by the MAX_CONNECTIONS property:
- 1 connection is reserved for the main thread used for authentication and synchronous requests.
- The remaining connections are used for concurrent requests.
See Also
wingpy.scheduling.TaskRunner
Schedule and run asynchronous tasks in parallel.
MAX_CONNECTIONS
¶
The maximum number of concurrent connections opened to the Cisco Cyber Vision API.
1 connection will be used for general synchronous requests.
9 connections will be used for parallel asynchronous requests.
RETRY_RESPONSES
¶
No explicit retry responses are defined for Cisco Cyber Vision.
headers
¶
A dictionary of HTTP headers to be sent with each request.
These headers will be merged with any headers dict passed to an individual request.
path_params
¶
A dictionary of path parameters to be used in the API path of each request.
These parameters will be merged with any path_params dict passed to the request.