tenable / tenable/pyTenable

tenable.sc.scan_instances.ScanResultAPI.import_scan - Error using "example"

Open
#960 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog documentation Tenable Security Center
Dominant language
Python
Stars
417
Forks
190
Avg merge
1d 10h
Merged PRs (30d)
3

Description

Description:

From SC ScanResultAPI.import_scan
using the example:

with open('example.nessus') as fobj:
    sc.scan_instances.import_scan(fobj, 1)

would result in the error:
TypeError: a bytes-like object is required, not 'str'

What works:

with open('example.nessus', 'rb') as fobj:
sc.scan_instances.import_scan(fobj, 1)

To confirm:

Is this an incorrect example or a library issue?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the linked ScanResultAPI.import_scan documentation and compare its example with the working binary-mode call shown here. Confirm whether the documented example should use binary mode; done means the example no longer raises the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.