v2: rewrite for the new OCI-hosted ForestSens API - #1
Merged
Conversation
Real breaking rewrite, not a patch -- the platform moved off the old
Oracle APEX API onto a new OCI-hosted one, so this client's entire
surface changed to match:
- Package renamed ForestSensAPI/ -> forestsens/ (matches the real
import/distribution name now, "forestsens").
- Auth: X-Api-Key header (not apitoken), calls go through the
dedicated /v1-key/{path*} Gateway route.
- Uploads: PUT-to-PAR for small files, resumable backend-mediated
chunked multipart for large ones (16 MiB threshold) -- ported the
logic (not code) from the platform's own verified frontend
implementation (uploadFiles.ts). Dropped the oci SDK dependency
entirely: PARs never supported real OCI multipart, so it was dead
weight.
- Batches: create_batch/get_batch/wait_for_batch (polls to
done/failed, raises BatchFailedError with step detail on failure).
- Downloads: download_artifacts() streams each artifact's live PAR
download_url to a local dir.
- list_pipelines() as supporting plumbing (needed to discover a real
pipeline_id/slot shape before creating a batch).
- Structured error handling: ForestSensAPIError parses the API's own
{data,meta,error} envelope, mirroring frontend/src/api/client.ts's
ApiRequestError, instead of only checking HTTP status.
- Modern pyproject.toml (PEP 621) replacing setup.py+requirements.txt;
pytest replacing bare unittest; a CI workflow (none existed before).
v1 scope deliberately narrow, per explicit instruction: upload, batch,
download only. No API-key management, no typed result tables
(detections/segments/tree-inventory), no batch retry/list -- those
stay on the new API's own roadmap, not duplicated here yet.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Real breaking rewrite -- the platform moved off the old Oracle APEX API onto a new OCI-hosted one, so this client's entire surface changed to match. Left open per usual practice, nothing auto-merges.
Scope deliberately narrow for v1: upload, batch, download only (plus pipeline discovery as supporting plumbing). No API-key management, no typed result tables, no batch retry/list yet.
ForestSensAPI/->forestsens/(real import/distribution name now).X-Api-Keyheader, calls go through the dedicated/v1-key/{path*}Gateway route.ociSDK dependency entirely (PARs never supported real OCI multipart).create_batch/get_batch/wait_for_batch(polls to done/failed, raisesBatchFailedErrorwith step detail).download_artifacts()streams each artifact's live PAR URL to a local dir.ForestSensAPIErrorparses the API's own{data,meta,error}envelope) instead of only checking HTTP status.pyproject.toml(PEP 621), pytest, a CI workflow (none existed before).12/12 tests pass (mocked HTTP, no live backend needed). Still to do before merging: a real manual smoke test against the deployed Gateway with a real API key.
🤖 Generated with Claude Code