Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Updated the _list funcition's limit code #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
venv/
__pycache__/
4 changes: 0 additions & 4 deletions py-list-vulnerabilities/list-vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@ def main():
f'{name:{15}} {vector:{6}} {severity:{10}} {cve}'
)

# Only asking for one scan doesn't mean that the iterator won't happily
# ask for the next one, so stop the loop here.
break


if __name__ == '__main__':
main()
8 changes: 7 additions & 1 deletion py-list-vulnerabilities/smartcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,13 @@ def _list(self, url, exception_kind, key, **kwargs):
# We use the link in the `Link: rel='next'` header as it's easier
# than building a URL based on the cursor in the body. If there is
# no header then there's no more data.
if not 'next' in response.links:
if kwargs.get('params'):
limit = kwargs['params']['limit']

if limit == 1:
break

if 'next' not in response.links:
break

# Extract the URL from the `Link: rel='next'` header.
Expand Down