Skip to content

feat!: follow background scans and read the v3 results - #4

Merged
RejectModders merged 3 commits into
mainfrom
feat/scan-jobs
Nov 29, 2026
Merged

RejectModders merged 3 commits into
mainfrom
feat/scan-jobs

Conversation

@RejectModders

Copy link
Copy Markdown
Member

Scans on the v3 API run in the background. Until now scan() and scan_crawl() started one and then raised. This follows them to the end.

  • scan() and scan_crawl() start the job, poll it and return the finished result.
  • client.scans starts, reports progress, waits for and cancels scans.
  • Results and findings match what the server sends, for 3.9.2 and the unreleased 4.0, and keep everything else in raw.
  • A failed, unfinished or unreadable scan raises. incomplete lists what was not checked, including two cases 3.9.2 does not report itself: checks that failed to run, and a crawl cut short by the quota.
  • Scanner names are checked before sending, because 3.9.2 accepts a misspelt one and runs nothing.
  • Targets without a scheme are accepted, and an unfamiliar severity is unknown instead of info.

Breaking changes are in the changelog. Reading the history list is the next change; history.list() still raises.

Tested locally on Windows with Python 3.11, 3.12 and 3.13: 267 offline tests pass, ruff and mypy --strict pass on 3.13, and the README examples type check. The tests build their replies from the server source; nothing was run against a live server, so the live tests are not run.

scan() and scan_crawl() now start the job, poll it and return the finished
result. client.scans starts, reports, waits for and cancels scans. An
unfinished or failed scan raises, so it can never read as a clean one.

Results and findings match what the server sends, keep unknown fields in
raw, and show what was not checked or was marked a false positive. An
unfamiliar severity is "unknown" instead of "info". Scanner names are
checked before sending, because older servers run nothing for a misspelt
one. Targets without a scheme are accepted.
Servers before 4.0 do not mark a scan incomplete when checks fail to run, or
a crawl incomplete when the quota cuts it short, so the SDK adds those marks
itself. Waiting for a scan now makes one request per poll and gives none
longer than the time left. Targets with a scheme later in the address or
with surrounding blanks are accepted, summary counts that are not numbers
are an error, and the default wait outlasts the server's crawl limit.
@RejectModders
RejectModders merged commit 5d54fce into main Nov 29, 2026
13 checks passed
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.

1 participant