Skip to main content

A library to facilitate querying data from recreation.gov

Project description

recgov

Python modules to interface with recreation.gov in order to find suitable availability.

Usage:

In order to use this library, you'll need to sign up for an api account. Enabling developer access is under your account settings page. You can either store the API KEY in your environment variables as RECREATION_GOV_KEY or you can pass it to your _session.get_session calls (much trickier -- not really supported).

To install from the checked out code:

pip install .

To make a link in python to the current code-base:

pip install --editable .

Generalizing the script:

recreation.gov works a little different. It has a promising documented API that provides access to campground details, but it doesn't seem to include any availability data.

Common fields used across the api:

Field Name Description
asset_id The campground overall
name Campsite name (often a number)
org_name Who owns the campsite
loop The loop where you can find the site

The most promising undocumented endpoint is here:

  • Month
    • Gets availability for an entire month.

The response object looks something like this:

{
 "availabilities": {
  "2021-03-01T00:00:00Z": "Available",
  // . . . .
  "2021-03-05T00:00:00Z": "Reserved",
  // . . . .
  "2021-03-12T00:00:00Z": "Not Available",
  // . . . .
  "2021-03-31T00:00:00Z": "Reserved"
 },
 "campsite_id": "7859",
 "campsite_reserve_type": "Site-Specific",
 "campsite_type": "GROUP TENT ONLY AREA NONELECTRIC",
 "capacity_rating": "Single",
 "loop": "DEVILS GARDEN CAMPGROUND",
 "max_num_people": 55,
 "min_num_people": 11,
 "quantities": null,
 "site": "JUNIPER BASIN",
 "type_of_use": "Overnight"
}

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release 0.1.4:

  • Implemented timezone aware datetimes
  • Added a changelog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

recgov-0.1.4.tar.gz (10.6 kB view hashes)

Uploaded Source

Built Distribution

recgov-0.1.4-py3-none-any.whl (11.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page