Skip to content

Conversation

@bswyatt
Copy link
Contributor

@bswyatt bswyatt commented Nov 21, 2024

No description provided.

…ded HTTP error 413 for content too large in modules/vectra.py. Also in modules/vectra.py, modified the default timeout value from 5 sec to 30 sec due to 5 being too short for most applications. Updated version in pyproject and setup.
…om platform.py that were in vectra.py. Expanded library to allow for multithreading. Added a function to download match rulesets for both vectra.py and platform.py. Expanded platform.py to support v3.4 and updated some v3.3 functions that were recently released. Also added some testing for the threading use case
@bswyatt bswyatt requested a review from HoneyBaked November 21, 2024 22:15
)
yield resp

if self.threads == 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion, this code block to handle threaded vs non-threaded may work better as a shared function/method

resp = self._request(method="get", url=resp.json()["next"])
yield resp

if self.threads == 1:
Copy link
Contributor

@HoneyBaked HoneyBaked Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may work better as a common method that is shared...

def yield_results(self, resp, method, params):
    if self.threads == 1:
        while resp.json()["next"]:
            resp = self._request(method=method, url=resp.json()["next"])
            yield resp
    else:
        count = resp.json()["count"]
        yield from self.get_threaded(url, count, params=params)

payload = open(f"{file_path}", "rb")
resp = requests.put(upload_url, data=payload)

if resp.status_code == 200:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: may be more future proof if you use request.codes.ok . That would handle if you get codes like 200 and 204

@HoneyBaked HoneyBaked merged commit 5126eb5 into vectranetworks:master Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants