Fix GoingToCamp KeyError and add attribute filtering support#398
Open
javamonkey79 wants to merge 2 commits intojuftin:mainfrom
Open
Fix GoingToCamp KeyError and add attribute filtering support#398javamonkey79 wants to merge 2 commits intojuftin:mainfrom
javamonkey79 wants to merge 2 commits intojuftin:mainfrom
Conversation
The GoingToCamp API has changed its /api/maps endpoint to no longer provide per-facility mapId lookups, causing a KeyError when listing campgrounds. This fix: - Uses rootMapId from /api/resourceLocation response instead of looking up mapId from /api/maps (which no longer has it) - Adds root_map_id field to ResourceLocation model - Gracefully handles the now-404 /api/resource/details endpoint by returning fallback site data so availability searches still work Fixes juftin#377 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The GoingToCamp API supports filtering by site attributes (like electric
hookups) via the filterData parameter, but it requires:
1. Using 'enumValues' instead of 'values' in the filter objects
2. JSON-encoding the filterData as a string
This change:
- Adds attribute_filters parameter to list_site_availability()
- Properly formats filterData with enumValues and JSON encoding
- Adds attribute_filters to SearchGoingToCamp class
- Adds attribute_filters to YAML config model for use with --yaml-config
Example YAML config for searching electric RV sites:
provider: GoingToCamp
recreation_area: 3
campgrounds: -2147483565
attribute_filters:
- attributeDefinitionId: -32767
enumValues: [3]
Common attribute IDs:
- Electrical Service (-32767): 0=None, 1=15A, 2=20A, 3=30A, 4=50A
- Service Type (-32768): 3=Standard, 5=Electric, 6=Elec+Water, 7=Full
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.
Summary
rootMapIdinstead of MapId lookup (builds on PR Fix GoingToCamp provider KeyError and broken site details endpoint #391 by @aniketde)attribute_filterssupport for GoingToCamp provider to filter campsites by attributes like electrical serviceenumValuesformat and JSON encoding as required by the GoingToCamp APIChanges
going_to_camp_provider.py: Use rootMapId, add attribute_filters parameter to list_site_availability(), properly JSON-encode filterDatasearch_going_to_camp.py: Pass attribute_filters through to providersearch_model.py: Add attribute_filters field to YAML config modelyaml_utils.py: Pass attribute_filters from YAML to provider kwargsUsage
Via YAML config file:
Common attribute filters:
Test plan
🤖 Generated with Claude Code