Skip to content

Commit e60a20a

Browse files
committed
finished findings api
1 parent 9dbf5c4 commit e60a20a

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

ThreadFixProApi/Networks/_utils/_findings.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,24 @@ def __init__(self, host, api_key, verify_ssl, timeout, headers, user_agent, cert
2121
the private key and the certificate) or as a tuple of both file’s path
2222
:param debug: Prints requests and responses, useful for debugging.
2323
"""
24-
super().__init__(host, api_key, verify_ssl, timeout, headers, user_agent, cert, debug)
24+
super().__init__(host, api_key, verify_ssl, timeout, headers, user_agent, cert, debug)
25+
26+
def fetch_all_findings(self, page=1, limit=50, href=None):
27+
"""
28+
Fetches all findings one page at a time of limit
29+
:param page: The page of the findings to get (optional if you have href)
30+
:param limit: The amount of findings per page
31+
:param href: The link to the next page in the system from a previous call
32+
"""
33+
# If href (calling another page gives an href tag for next page in line)
34+
if href:
35+
return super().request('GET', '/api/network' + href)
36+
# First call
37+
return super().request('GET', f'/api/network/findings?_page={page}&_limit={limit}')
38+
39+
def find_finding_by_id(self, finding_id):
40+
"""
41+
Gets a finding by its id
42+
:param finding_id: ID of the finding to get
43+
"""
44+
return super().request('GET', f'/api/network/findings/{finding_id}')

ThreadFixProApi/Networks/_utils/_scans.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def fetch_all_scans(self, page=1, limit=50, href=None, scan_status_enum=None, sc
3030
:param page: The page of the scans to get (optional if you have href)
3131
:param limit: The amount of scans per page
3232
:param href: The link to the next page in the system from a previous call
33+
:param scan_status_enum: Filters based on the scans status value. Enum takes numeric values from 1-12
34+
:param scan_date: Fetch scans that occurred on this date
3335
"""
3436
params = {}
3537
if scan_status_enum:

0 commit comments

Comments
 (0)