Nettacker icon indicating copy to clipboard operation
Nettacker copied to clipboard

Upgrade API Documentation to be Python 3 Compatible

Open jess-tech-lab opened this issue 9 months ago โ€ข 2 comments

Proposed change

This PR updates the API document API.md to transition all Python examples from Python 2 to Python 3.10+. The current documentation contains deprecated syntax including print ..., the u' string prefix, and missing byte decoding, which leads to errors in Python 3.

Proposed changes are as follows:

  • Byte-to-String Handling: Updated all r.content examples to include .decode('utf-8') to prevent TypeError in Python 3.
  • SSL/TLS Configuration: Added explicit verify=False to all example requests to prevent the error certificate verify failed: self-signed certificate since by default Python 3 enforces certificate verification and the API uses a self-signed certificate.
  • Syntax Change: Changed print ... to print(...) and removed Python 2 specific unicode prefix u'.

Type of change

  • [ ] New core framework functionality
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] Code refactoring without any functionality changes
  • [ ] New or existing module/payload change
  • [x] Documentation/localization improvement
  • [ ] Test coverage improvement
  • [ ] Dependency upgrade
  • [ ] Other improvement (best practice, cleanup, optimization, etc)

Checklist

  • [x] I've followed the contributing guidelines
  • [ ] I've run make pre-commit, it didn't generate any changes
  • [ ] I've run make test, all tests passed locally

jess-tech-lab avatar Feb 23 '26 03:02 jess-tech-lab

No actionable comments were generated in the recent review. ๐ŸŽ‰

โ„น๏ธ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 7e8d1dc0b73cd8cee9fcc5eb4caf47d2cc3d73ed and ec34e3f6958163ec804a11627c1ae1e2af3bac19.

๐Ÿ“’ Files selected for processing (1)
  • docs/API.md

Summary by CodeRabbit

  • Documentation
    • Updated API docs: examples now show disabling SSL verification for local self-signed certificates (with a clear warning not to use this against external/production hosts) and demonstrate decoded/JSON response handling in example requests and outputs.

Walkthrough

Adds a note about disabling SSL warnings for local Nettacker API with self-signed certificates and updates HTTP examples to use verify=False and to parse responses with r.json() or r.text instead of raw r.content.

Changes

Cohort / File(s) Summary
API Documentation Examples
docs/API.md
Added a note explaining disable_warnings(InsecureRequestWarning) and that verify=False is for local/self-signed certs only. Updated HTTP examples to include verify=False. Replaced r.content-based outputs with r.json() or r.text across examples (new scan, session flows, results retrieval, hosts listing, HTML/JSON outputs). Status code checks and overall flows preserved.

Estimated code review effort

๐ŸŽฏ 3 (Moderate) | โฑ๏ธ ~20 minutes

๐Ÿšฅ Pre-merge checks | โœ… 3
โœ… Passed checks (3 passed)
Check name Status Explanation
Title check โœ… Passed The title accurately reflects the main change: updating API documentation for Python 3 compatibility, which aligns with the described changes to syntax, byte handling, and SSL verification.
Description check โœ… Passed The description is directly related to the changeset, providing clear details about Python 2 to Python 3 migration including byte decoding, SSL verification, and syntax updates.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

โœ๏ธ Tip: You can configure your own custom pre-merge checks in the settings.

โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Feb 23 '26 03:02 coderabbitai[bot]

@arkid15r and @securestep9 - can you review? Thanks.

jess-tech-lab avatar May 08 '26 14:05 jess-tech-lab