fix(duffel): target Duffel API v2 /air endpoints - #17
Merged
manish-wekan merged 1 commit intoSep 8, 2026
Merged
Conversation
Every DuffelService request 404'd as soon as a real DUFFEL_API_KEY was configured. Two causes: the client sent `Duffel-Version: v1`, and the flight endpoints omitted the `/air` namespace that v2 requires. Verified against the live API with a test key: `v2 + /air/airlines` and `v2 + /places/suggestions` return 200, while `v1 + /airlines` and `v2 + /airlines` both 404. - Duffel-Version: v1 -> v2 - /air prefix on offer_requests, offers, seat_maps, orders (POST + GET), order_cancellations and airlines - search_airports now calls /places/suggestions; the previous /air/suggestions call and its /places?type=airport fallback were both non-existent endpoints, so the try/except only ever traded one 404 for another - same fix applied to the copy inlined in the CLI scaffolder The defect was invisible until now because _is_mock_key() routes the shipped placeholder key into mock mode, which never calls _request, so it only surfaced the first time the template was used for real. Adds a regression test that pins the method, URL and version header for all eight calls against a stubbed urlopen. Co-authored-by: Cursor <[email protected]>
aviabhijit55-ship-it
force-pushed
the
fix/duffel-v2-air-endpoints
branch
from
September 8, 2026 06:46
cce9b9f to
e57091a
Compare
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.
Problem
Every
DuffelServicerequest returnsHTTP Error 404: Not Foundas soon as a realDUFFEL_API_KEYis configured. The client sendsDuffel-Version: v1and omits the/airnamespace that Duffel API v2 requires.This was invisible until now because
_is_mock_key()routes the shipped placeholder key (your-duffel-api-key) into mock mode, which never calls_request. The defect only surfaces the first time thepython-oauthtemplate is used with a genuine key.Evidence
v1/airlinesv2/airlinesv2/air/airlinesv2/places/suggestions?query=LondonChanges
Duffel-Version: v1->v2/airprefix onoffer_requests,offers/{id},seat_maps,orders(POST and GET),order_cancellations,airlinessearch_airportsnow calls/places/suggestions. The old/air/suggestionscall and its/places?type=airportfallback are both non-existent endpoints, so thetry/exceptonly ever traded one 404 for another.nitrostack/cli/main.pyVerification
Ran the patched service against the live Duffel API with a test key:
get_airlinesreturned 50 airlines,search_airports("London")returned 14 hits led byLON, andsearch_flights(JFK->LAX)returned 73 real offers.New regression test pins the method, URL, and version header for all eight calls against a stubbed
urlopen. Full suite green.Not included
Two things are deliberately out of scope, each worth its own PR:
examples/flight_booking_server.py(lines 108-340) with the same defect..pycfiles are tracked in git despite the__pycache__/ignore rule, which only applies to untracked paths.