Skip to content

bug: Alerts V2 throws unexpected KeyError #176

Open
@harsh-leen

Description

@harsh-leen

Describe the bug
When lacework environment contains zero alerts, python-sdk is not able to handle the json response correctly and throws unexpected KeyError.

Sample trace:

Traceback (most recent call last):
    ...
    alerts = self.lacework_client.alerts.get(
  File ".../lib/python3.10/site-packages/laceworksdk/api/v2/alerts.py", line 50, in get
    return_data["paging"] = response_json["paging"]
KeyError: 'paging'

To Reproduce
Steps to reproduce the behavior:

  1. Use lacework env with 0 alerts
  2. Initialize the client and fetch alerts in following manner:
alerts = lacework_client.alerts.get(
    start_time=start_time_str, end_time=end_time_str
)

Please complete the following information:

  • OS: macOS Sonoma 14.5 on ARM
  • Library Version: Current latest eg. 4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions