ebarti / cortex-xdr-client

A python-based API client for Cortex XDR API.

Home Page:https://cortex-xdr-client.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parse_obj fail

lawiet47 opened this issue · comments

commented

The parse on models/alerts.py fails on parsing response json for the alerts_api for some alerts. I got the raw response before parsing and it might be the ' OR " json issue. For example some alerts return a simple description as "Suspicious executable detected" where others return ""The \'schtasks\' command was executed on DESKTOP-XXXX to schedule a local task. Child process command line: \\""

Traceback (most recent call last): File "/Users/r/Library/Application Support/JetBrains/PyCharm2021.3/scratches/scratch.py", line 12, in <module> end = auto.alerts_api.get_alerts(search_from=25, search_to=26) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cortex_xdr_client/api/alerts_api.py", line 63, in get_alerts return GetAlertsResponse.parse_obj(response.json()) File "pydantic/main.py", line 521, in pydantic.main.BaseModel.parse_obj File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__ pydantic.error_wrappers.ValidationError: 1 validation error for GetAlertsResponse reply -> alerts -> 0 -> description str type expected (type=type_error.str)