Skip to content

Fix GoingToCamp KeyError and add attribute filtering support#398

Open
javamonkey79 wants to merge 2 commits intojuftin:mainfrom
javamonkey79:fix/goingtocamp-keyerror-campground-listing
Open

Fix GoingToCamp KeyError and add attribute filtering support#398
javamonkey79 wants to merge 2 commits intojuftin:mainfrom
javamonkey79:fix/goingtocamp-keyerror-campground-listing

Conversation

@javamonkey79
Copy link
Copy Markdown

Summary

  • Fixes KeyError when listing campgrounds by using rootMapId instead of MapId lookup (builds on PR Fix GoingToCamp provider KeyError and broken site details endpoint #391 by @aniketde)
  • Adds attribute_filters support for GoingToCamp provider to filter campsites by attributes like electrical service
  • Fixes API filterData encoding to use enumValues format and JSON encoding as required by the GoingToCamp API

Changes

  • going_to_camp_provider.py: Use rootMapId, add attribute_filters parameter to list_site_availability(), properly JSON-encode filterData
  • search_going_to_camp.py: Pass attribute_filters through to provider
  • search_model.py: Add attribute_filters field to YAML config model
  • yaml_utils.py: Pass attribute_filters from YAML to provider kwargs

Usage

Via YAML config file:

provider: GoingToCamp
recreation_area: 11
campgrounds: 15
start_date: 2026-04-01
end_date: 2026-04-03
attribute_filters:
  - attributeDefinitionId: -32767
    enumValues: [3]  # 30A electric

Common attribute filters:

  • 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 hookup

Test plan

  • Tested searching Washington State Parks (Riverside State Park, Bowl and Pitcher)
  • Verified attribute filtering reduces results correctly (17 RV sites → 3 with 30A electric)

🤖 Generated with Claude Code

aniketde and others added 2 commits March 7, 2026 01:14
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
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