Skip to content

feat(license): wrap GET /license/export-csv endpoint#191

Closed
Valyrian-Code wants to merge 1 commit into
fossology:mainfrom
Valyrian-Code:feat/license-export-import
Closed

feat(license): wrap GET /license/export-csv endpoint#191
Valyrian-Code wants to merge 1 commit into
fossology:mainfrom
Valyrian-Code:feat/license-export-import

Conversation

@Valyrian-Code

@Valyrian-Code Valyrian-Code commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Refs #52.

Adds LicenseEndpoint.export_licenses_csv() for GET /license/export-csv — the export counterpart to the merged import_licenses_csv() (#185). Returns the exported licenses as CSV text and accepts an optional license id (0 = all).

API details

Verified against Fossology 4.4.0 (API 1.6.1) running in a container.

Tests

  • export → import round-trip — passes live. Idempotent, and robust because the export output is exactly what import_licenses_csv() expects (no hand-crafted fixture that could drift from the server schema).
  • Mocked 403 error path.

ruff and mypy pass; the export tests pass against a live fossology 4.4.0 container.

Scope note: I originally included import-json / export-json here too, but those routes do not exist in fossology 4.4.0 (they are API 1.6.2 / master-only) and 404 against the CI container, so I dropped them from this PR.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 1, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the Python Fossology client’s license import/export support by adding wrappers for the remaining REST endpoints in the license import/export surface (CSV export, JSON import, JSON export), along with integration and mocked-error tests to validate behavior against the API contract referenced in #52.

Changes:

  • Add export_licenses_csv() wrapping GET /license/export-csv (returns CSV text; raises on non-200).
  • Add import_licenses_json() wrapping POST /license/import-json (multipart upload using fileInput; returns server message; raises on non-200).
  • Add export_licenses_json() wrapping GET /license/export-json (returns parsed JSON; raises on non-200) and corresponding round-trip + error-path tests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
fossology/license.py Implements CSV export, JSON import, and JSON export license endpoint wrappers with consistent success/error handling.
tests/test_license.py Adds round-trip integration tests for CSV/JSON and mocked error/payload assertions (including fileInput multipart field name).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Refs fossology#52.

Adds LicenseEndpoint.export_licenses_csv() for GET /license/export-csv, the
export counterpart to the merged import_licenses_csv() (fossology#185). Returns the
exported licenses as CSV text and accepts an optional license id (0 = all).

Verified against Fossology 4.4.0 (API 1.6.1) running in a container: an
export->import round-trip test passes (idempotent), plus a mocked 403 error
path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
@Valyrian-Code Valyrian-Code force-pushed the feat/license-export-import branch from fe441d9 to a32535e Compare July 1, 2026 15:50
@Valyrian-Code Valyrian-Code changed the title feat(license): wrap license export-csv, import-json and export-json endpoints feat(license): wrap GET /license/export-csv endpoint Jul 1, 2026
@Valyrian-Code

Copy link
Copy Markdown
Contributor Author

Superseded by #196.

@Valyrian-Code Valyrian-Code deleted the feat/license-export-import branch July 1, 2026 17:03
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.

2 participants